Bajardi: Saidov Humoyiddin
Download 307.28 Kb.
|
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI Amaliy ish Bajardi: Saidov Humoyiddin 412 gurux talabasi TOSHKENT 2022 #include using namespace std; int main() { ofstream out("outout.txt"); string s; getline(cin, s); int r = 0, k = 0, t = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == 't') { t++; } if (s[i] == 'k') { k++; } if (s[i] == r) { r++; } } out << s << endl; out << "satrdagi t lat soni: " << t << endl; out << "satrdagi k lat soni: " << k << endl; out << "satrdagi r lat soni: " << r << endl; return 0; } #include #include #include #include using namespace std; class Mashina { public: string mashina1[3] = { "Malibu", "chevrolet", "200 mln so'm", }; string mashina2[3] = { "Malibu2", "chevrolet", "250 mln so'm",}; string mashina3[3] = { "Spark", "chevrolet", "100 mln so'm",}; string mashina4[3] = { "Lacetti", "chevrolet", "150 mln so'm",}; string mashina5[3] = { "Gentra", "chevrolet", "180 mln so'm",}; }; int main(int argc, char **argv) { Mashina object; string search; int counter = 1; cout << "mashinaning nomini kiriting:" << "\n"; getline(cin, search); cout << "Siz qidirgan mashina:" << "\n"; for (int i = 0; i < sizeof(object.mashina1) / 32; i++) { if (object.mashina1[i] == search) { for (int j = 0; j < sizeof(object.mashina1) / 32; j++) { cout << object.mashina1[j] << "\n"; } } } cout << "\n"; for (int i = 0; i < sizeof(object.mashina2) / 32; i++) { if (object.mashina2[i] == search) { for (int j = 0; j < sizeof(object.mashina2) / 32; j++) { cout << object.mashina2[j] << "\n"; } } } cout << "\n"; for (int i = 0; i < sizeof(object.mashina3) / 32; i++) { if (object.mashina3[i] == search) { for (int j = 0; j < sizeof(object.mashina3) / 32; j++) { cout << object.mashina3[j] << "\n"; } } } cout << "\n"; for (int i = 0; i < sizeof(object.mashina4) / 32; i++) { if (object.mashina4[i] == search) { for (int j = 0; j < sizeof(object.mashina4) / 32; j++) { cout << object.mashina4[j] << "\n"; } } } cout << "\n"; for (int i = 0; i < sizeof(object.mashina5) / 32; i++) { if (object.mashina5[i] == search) { for (int j = 0; j < sizeof(object.mashina5) / 32; j++) { cout << object.mashina5[j] << "\n"; } } } cout << "\n"; return 0; } String turidagi A satrning ixtiyoriy belgisi va so’zini ixtiyoriy belgi va so’zga almashtiruvchi dastur tuzing. Download 307.28 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling