Xaitov Akmal 715-22-guruh talabasi
Download 0.8 Mb.
|
xaitov akmal 2-ish
Xaitov Akmal 715-22-guruh talabasi 1-savol: 1-javob: #include #include #include #include #include using namespace std; /*24.1 Berilgan float turidagi to’plam qiymatlarining yaxlitlab(o’zidan katta yoki teng bo’lgan butun songacha yaxlitlab) 2- to’plamga, ikki to’plam ayirmasini(3=1-2) 3- to’plamga joylashtiruvchi va ularni ekranga chiqaruvchi dastur tuzing.*/ int main(){ srand(time(0)); multiset for(int i=0;i<10;i++) s1.insert((rand()%50)/10.); cout<<" 1-to'plam elementlari: "; for(auto a:s1){ cout<s2.insert(ceil(a));}cout< for(auto a:s2) cout<multiset iter1=s1.begin(); iter2=s2.begin(); while(iter1!=s1.end()){ s3.insert(*iter1-*iter2); iter1++; iter2++;} cout<<" 3-to'plam elementlari: "; for(auto a:s3) cout<return 0;} 2-savol:
2-javob:
using namespace std; int main() { // Operatsion tizimlar map // Ma'lumotlarni yuklash os["Windows 3.1"] = make_pair(1992, make_pair(16, "x86")); os["Windows 95"] = make_pair(1995, make_pair(32, "x86")); os["Windows 98"] = make_pair(1998, make_pair(32, "x86")); os["Windows 2000"] = make_pair(2000, make_pair(32, "x86")); os["Windows XP"] = make_pair(2001, make_pair(32, "x86")); os["Windows Vista"] = make_pair(2006, make_pair(32, "x86, x64")); os["Windows 7"] = make_pair(2009, make_pair(32, "x86, x64")); os["Windows 8"] = make_pair(2012, make_pair(32, "x86, x64")); os["Windows 10"] = make_pair(2015, make_pair(32, "x86, x64")); // Foydalanuvchidan operatsion tizim nomini olish string searchOS; cout << "Operatsion tizimni kiriting: "; getline(cin, searchOS); string fileName; cout << "Fayl nomini kiriting: "; getline(cin, fileName); // Operatsion tizimni qidirish multimap auto it = os.find(searchOS); if (it != os.end()) { foundOS.insert(*it); } // Faylga yozish ofstream outfile(fileName); if (outfile.is_open()) { for (auto it = foundOS.begin(); it != foundOS.end(); ++it) { outfile << it->first << ", " << it->second.first << ", " << it->second.second.first << ", " << it->second.second.second << endl; } outfile.close(); cout << "Ma'lumotlar faylga saqlandi." << endl; } else { cout << "Faylni ochib bo'lmadi." << endl; } return 0; } Download 0.8 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling