IKKINCHI ASSISMENT TOPSHIRIG‘I
|
Konteyner sinflarga 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
int main() {
std::vector myVector;
for (int count = 0; count < 5; ++count)
myVector.push_back(count);
std::vector::const_iterator itV;
itV = myVector.begin();
while (itV != myVector.end()) {
std::cout << *itV << " ";
++itV;
}
std::cout << '\n';
std::list myList;
for (int count = 0; count < 5; ++count)
myList.push_back(count);
std::list::const_iterator itL;
itL = myList.begin();
while (itL != myList.end())
{
std::cout << *itL << " ";
++itL;
}
std::cout << '\n';
std::setmySet;
mySet.insert(28);
mySet.insert(01);
mySet.insert(80);
mySet.insert(9);
mySet.insert(3);
std::set::const_iterator itS;
itS = mySet.begin();
while (itS != mySet.end())
{
std::cout << *itS << " ";
++itS;
}
std::cout << '\n';
system("pause");
return 0;
}
|
1. Dasturdagi eng katta xatoni toping.
_______________________________
_______________________________
_______________________________
|
2. Dasturda aniqlangan myVector, myList, mySet konteynerlarning elementlari bir xil bo‘lishi uchun kerakli dastur fragmentlarini yozing.
_______________________________
_______________________________ _______________________________ _______________________________
_______________________________
|
3. itV qanday konteyner va nima uchun.
_______________________________
_______________________________
_______________________________
4. Dasturda dasturchining yana bir oddiy xatosini toping.
_______________________________ _______________________________
_______________________________
5. Dasturdagi barcha konteynerlarni yarim ele mentlarini chiqarish dastur fragmentlarini tuzing.
_______________________________ _______________________________
_______________________________
|
6. Dasturda jami bo‘lib, necha o‘zgartirish kiritildi. _______________
7. Shu dasturning analogini yaratish sizga mustaqil vazifadir.
|