Private: String model
Download 13.9 Kb.
|
Hujjat (1)
#include Using namespace std; Namespace stulstol{ Class Stul { Private: String model; String rangi; Int yili; Double Narxi; Public: Stul() {} Stul(string m, string c, int y, double p) { Model = m; Rangi = c; Yili = y; Narxi = p; } Void chiqarish() { Cout << “Stul:\n”; Cout << “Model: “ << model << endl; Cout << “Rangi: “ << rangi << endl; Cout << “Ishlab chiqarilgan yili: “ << yili << endl; Cout << “Narxi: “ << Narxi << endl; } }; Class Stol { Private: String model; String rangi; Int yili; Double Narxi; Public:
Stol(string m, string c, int y, double p) { Model = m; Rangi = c; Yili = y; Narxi = p; } Void chiqarish() { Cout << “Stol:\n”; Cout << “Model: “ << model << endl; Cout << “Rangi: “ << rangi << endl; Cout << “Ishlab chiqarilgan yili: “ << yili << endl; Cout << “Narxi: “ << Narxi << endl; } }; Void Search(Stul ch[], Stol p[], int nomer) { Cout << endl << endl; If(nomer>=1 && nomer<=5){ Cout << nomer << “-tartib raqami bo’yicha mos keladigan Stul va Stol: \n”; Ch[nomer – 1].chiqarish(); Cout << endl << endl; Cout << “ ~ Unga mos ~\n”; P[nomer – 1].chiqarish(); } Else{ Cout << “Notogri raqam tanladingiz”; } } } Int main() { String Stol_nomi[] = { “Dars Stol”, “Oddiy Stol “,”Oshxona Stol”,”Kompyuter Stol”,”Ish Stol” }; String Stul_nomi[] = { “Dars stul”,”Oddiy Stul”,”Oshxona Stul “,”Kompyuter Stul”,”Ish Stul” }; String Stul_rangi[] = {“Oq”, “Kok”, “Aralash”, “Qora”, “Sariq”}; String Stol_rangi[] = {“Oq”, “Kok”, “Aralash”, “Qora”, “Sariq”}; Int Stul_yili[] = {2010, 2015, 2016, 2022, 2023}; Int Stol_yili[] = {2010, 2015, 2016, 2022, 2023}; Int Stul_narxi[] = {400000, 500000, 600000, 700000, 800000}; Int Stol_narxi[] = {400000, 500000, 600000, 700000, 8000000}; Int tartib_raqami[] = { 1, 2, 3, 4, 5 }; Stulstol::Stol Stollar[100]; Stulstol::Stul Stullar[100]; For (int i = 0; i < 5; i++) { Stullar[i] = stulstol::Stul(Stul_nomi[i], Stul_rangi[i], Stul_yili[i], Stul_narxi[i]); Cout << endl; Stollar[i] = stulstol::Stol(Stol_nomi[i], Stol_rangi[i], Stol_yili[i], Stol_narxi[i]); Cout << i + 1 << “. “ << Stul_nomi[i] << endl; } Int number; Cout << endl; Cout << “Siz tanlagan Stul tartib raqamini kiriting: “; Cin >> number; Stulstol::Search(Stullar, Stollar, number); Return 0; } Download 13.9 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling