Srand((unsigned int)(time(null)))
Download 21.82 Kb.
|
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETINING DASTURIY INJINIRING FAKULTETI TALABASI Quvonchbek TohirovNING DASTURLASH II FANIDAN LABARATORIYA ISHI #include #include #include #include using namespace std; int main() { int n, k, min; cout << "Input n(n>5) = "; cin >> n; vector srand((unsigned int)(time(NULL))); for (int i = 0; i <= n; i++) { k = rand() % 10 + 3; array.push_back(k); } for (auto i = array.begin(); i != array.end(); i++) { cout << *i << " "; } cout << "\n"; array.at(5) = 32; for (auto i = array.begin(); i != array.end(); i++) { cout << *i << " "; } min = *min_element(array.begin(), array.end()); cout << "\n array's minimumn elements min = " << min << endl; }
#include #include #include #include #include using namespace std; int main() { int n, k, s = 0; cout << "Input n = "; cin >> n; srand(time(NULL)); deque for (int i = 0; i < n; i++) { k = rand() % 10 + 1; dek.push_front(k); } cout << " dek's elements : "; for (auto it = dek.begin(); it != dek.end(); it++) { cout << ' ' << *it; } cout << endl; for (auto it = dek.begin(); it != dek.end(); it++) { if (*it % 2 == 0) { s += *it; } // cout << "dek 's elements:" << ' ' << *it; } cout << "dek's couple elemnts summa: " << s; }
#include #include #include #include using namespace std; int main() { int n, k, p = 1; cout << "Input n = "; cin >> n; srand(time(NULL)); queue queue for (int i = 0; i < n; i++) { k = rand() % 10 + 1; que1.push(k); que2=(que1); } while(!que1.empty()) { p = p * que1.front(); que1.pop(); } cout << "Mulitpacitron summa : " << p; cout << endl; cout << " que's elements : "; while (!que2.empty()) { cout << que2.front() << ' '; que2.pop(); } //print_queue(que); } Download 21.82 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling