Almurodov Lochinbekning dasturlashdan amaliy topshiriq ishlari
Download 74.82 Kb.
|
Almurodov Lochinbekning dasturlashdan amaliy topshiriq ishlari
Almurodov Lochinbekning dasturlashdan amaliy topshiriq ishlari 1.Ro'yxatdagi eng kichik elementini toping. #include #include #include #include using namespace std; int main(){ int n; cout<<"Elementlar soni:";cin>>n; vector srand(time(NULL)); for(int i=0;i } int min=random.front(); for(int i=0;i for(int i=0;i cout<<"\nmin element:"< } 1.Deque barcha juft elementlari o'chirilsin. #include using namespace std; int main() { deque srand(time(NULL)); for (int i = 1; i <= 10; i++) { d.push_back(rand() % 100+i); } cout << "Deque before removal of even elements: "; for (auto x : d) { cout << x << " "; } cout << endl; // Even elements are removed for (auto it = d.begin(); it != d.end(); ) { if (*it % 2 == 0) { it = d.erase(it); } else { ++it; } } cout << "Deque after removal of even elements: "; for (auto x : d) { cout << x << " "; } cout << endl; return 0; } 1.Tasodifiy n ta son bilan stekni to'ldiring va shu stekdagi musbat elementlar sonini toping. #include using namespace std; int main(){ stack srand(time(NULL)); int n; cin>>n; int i1=-1; for(int i=0; i stack.push(i1*rand()%100+i); } int count=0; while(!stack.empty()){ cout< count++; } stack.pop(); } cout<<"\n"< Download 74.82 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling