#include using namespace std; int main { deque myDeque = {1, 2, 3}; if (!myDeque empty) { myDeque assign(4, 0); } cout


Download 351.01 Kb.
Sana22.04.2023
Hajmi351.01 Kb.
#1381170
Bog'liq
2-амалий иш


MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI
UNIVERSITETI




2-amaliy ish
DASTURLASH 2

Bajardi: SWD 011-3. gurux talabasi Abdumavlonov Baxt


Tekshirdi: Rustamova Mohichehra Yaxshibayevna
2– variant

Ro’yxat berilgan ekrandan kirtilgan sondan qiymati katta elementlarni toping.

#include
using namespace std;
int main() {
int arr[] = {5, 2, 8, 3, 9, 1};
int num;
cout << "Enter a number: ";
cin >> num;
cout << "Items greater than " << num << ": ";
for (int i = 0; i < sizeof(arr)/sizeof(arr[0]); i++) {
if (arr[i] > num) {
cout << arr[i] << " "; } }
cout << endl;
return 0; }

Deque agar bo’sh bo’lmasa assign() barcha elementlari almashtirilsin.

#include
#include
using namespace std;
int main() {
deque myDeque = {1, 2, 3};
if (!myDeque.empty()) {
myDeque.assign(4, 0); }
cout << "myDeque: ";
for (auto it = myDeque.begin(); it != myDeque.end(); ++it) {
cout << *it << " "; }
cout << endl;
return 0; }

Download 351.01 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling