For i=myse begin;i!=myse end
Download 240.79 Kb.
|
misol
11-variant Berilgan string turdagi to’plamning kata harfdan iborat elementlarini o’chiruvchi va kichik harfdan iborat elementlaridan 2-to’plamni hosil qiluvchi hamda ularni ekranga chiqaruvchi dastru tuzing #include #include using namespace std; int main() { set set myset1.insert("OLMA"); myset1.insert("behi"); myset1.insert("xurmo"); myset1.insert("GILOS"); myset1.insert("olma"); myset1.insert("shaftoli"); for(i=myset1.begin();i!=myset1.end();i++) cout<<*i<<" "; cout< for(i=myset2.begin();i!=myset2.end();i++) cout<<*i<<" "; cout< } Fanalar haqida (nomi, o’qituvchi_FIO, 5 chilar soni, 4 chilar soni, 3 chilar soni va o’zlashtira olmaganlar soni) to’plam berilgan. Fanlarni nomi, o’qituvchi_FIO, 5 chilar soni, 4 chilar soni, 3 chilar soni va o’zlashtira olmaganlar soni bo’yicha qidiruvchi hamda topilgan natijani faylga saqlashni taklif qiladigan dastur tuzing #include #include #include #include using namespace std; class PC { public: string name; string type; int short_memory; int permanent_memory; int usability_rating; int year_of_manufacture; PC(string n, string t, int s, int p, int u, int y) : name(n), type(t), short_memory(s), permanent_memory(p), usability_rating(u), year_of_manufacture(y) {} }; void saveResultsToFile(vector & pcs, int sum) { ofstream file("Natijalar.txt"); if (file.is_open()) { for (int i = 0; i < pcs.size(); i++) { file << "Fan: " << pcs[i].name << endl; file << "O'qituvchi: " << pcs[i].type << endl; file << "5 chilar: " << pcs[i].short_memory << endl; file << "4 chilar: " << pcs[i].permanent_memory << endl; file << "3 chilar: " << pcs[i].usability_rating << endl; file << "o'zlashtirmaganlar: " << pcs[i].year_of_manufacture << endl << endl; } file << "Reyting: " << sum << endl; file.close(); } else { cout << "Faylni ochib bo'lmaydi!"; } } int main() { vector pcs; int sum = 0; pcs.push_back(PC("Fizika", "M.N. Eshmatov", 4, 6, 9, 2)); pcs.push_back(PC("Matematika", "N.M. Toshmatov", 5, 5, 5, 6)); pcs.push_back(PC("Tarix", "S.A. Abdullayeva", 6, 9, 4, 2)); pcs.push_back(PC("Dasturlash", "S.R. Fayzullayev ", 9,9,2,1)); for (int i = 0; i < pcs.size(); i++) { sum += pcs[i].usability_rating; } saveResultsToFile(pcs, sum); string line; ifstream myfile("Natijalar.txt"); if (myfile.is_open()) { while (getline(myfile, line)) { cout << line << endl; } myfile.close(); } return 0; } Download 240.79 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling