Assisment topshirig‘I


Download 18.36 Kb.
Sana22.04.2023
Hajmi18.36 Kb.
#1377401
Bog'liq
chiqizli konteynerlar


ASSISMENT TOPSHIRIG‘I




Ketma ket konteynerlardan foydalanishga oid berilgan quyidagi dastur bo‘yicha berilgan topshiriqlar kerakli fragmentlari asosida bajaring. Bunda dasturdagi baʻzi o‘zgartirishlarni topish orqali topshiriqlar bosqichma – bosqich amalga oshriladi.

dastur

topshiriqlar

#include
#include
#include
#include
using namespace std;
struct student {
char fio[80];
short age;
student(const char* fio, short age) : age(age) {
strncpy_s(this->fio, fio, sizeof(this -> fio));
}
};
inline ostream& operator <<(ostream& out, const student& obj)
{
return out << obj.fio << "\t: " << obj.age;
}
struct trimatrix : vector< vector> {
trimatrix(int n) {
while (n > 0) {
vector row(n);
for (int i = 0; i < n; i++)
row[i] = n - i;
push_back(row);
n--;
}
}
};
inline ostream& operator << (ostream& out, const trimatrix& obj) {
for (int i = 0; i < obj.size(); i++) {
for (int j = 0; j < obj[i].size(); j++)
cout << obj[i][j] << " ";
cout << endl;
}
return out;
}
int main(int argc, char ** argv) {
setlocale(LC_ALL, "rus");
vector group;
group.push_back(student("Boynazarov I.M.", 18));
group.push_back(student("Djumayozov U.Z.", 21));
group.push_back(student("Bobonazarov A.A.", 19));
for (int i = 0; i < group.size(); i++)
cout << group[i] << endl;
cout << trimatrix(4);
int k, n;
vector a(n = rand() + 1, true);
a[0] = a[1] = false;
for (k = 2; k < n; k++)
for (vector :: iterator j = a.begin() + k + k; j *j = false;
const int line = 10;
k = 0;
for (vector :: iterator j =a.begin(); j < a.end(); j++)
if (*j) {
cout << j - a.begin() << "\t";
if (0 == ++k% line)
cout<< endl;
}
if (k % line != 0)
cout << endl;
system("pause");
return 0;
}

1. Dasturdagi yangi tiplarni aniqlang.
________________________________
________________________________
________________________________
________________________________

2. Dasturdagi ketma ket konteynerlar dastur fragmentini yozing.
________________________________ ________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________ ________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________

3. Dasturda keraksiz bo‘lgan dastur fragmentlarini o‘chirib tashlang
________________________________
________________________________
________________________________
4. vector konteynerini boshqa ketma-ket konteynerga almatirish uchun kerakli dastur fragmentlari yozing.
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
5. Dasturdagi ketma ket konteynerlar uchun asosiy funksiyalarni yozing.
________________________________
________________________________
________________________________
________________________________

6. Dasturda jami bo‘lib, necha o‘zgartirish kiritildi. _______________
7. Shu dasturning analogini yaratish sizga mustaqil vazifa.

Download 18.36 Kb.

Do'stlaringiz bilan baham:




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