#include using namespace std
Download 0.52 Mb.
|
5-iw 2-variant
- Bu sahifa navigatsiya:
- include using namespace std; class Tovar{ private: string nomi; int miqdori,narxi, sana[3];
- cout } int narx(){
- a[i].chiqar(); k++; } } if(k){ cout }else{
- for(int i=0;i tovarlar[i].kirit(); } qidir(tovarlar,n); } Javob
O’ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYA-LARI VA KOMMUNIKATSIYALARINI RIJOJLANTIRISH VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI Dasturlash fani bo’yicha Laboratoriya ishi-5 Bajardi: 1-kurs talabasi Abdumo’minov O’tkir Tekshirdi: Begulov O’tkir 2-variant 1)Savol: Kod:
#include using namespace std; class Shar { private: float pi = 3.1415, r, d = 2 * r, s = 0, v = 0; string tur; public: Shar (float r, float d, float pi) { this->r = r; this->d = d; this->pi = pi; }; void setYP() { this->s = (4*pi*r*r); this->v = (4/3.*pi*r*r*r); } void getYP() { cout << "Shar hajmi: " << v; cout << " Shar yuzi: " << s << endl; } void set_tomon(float r, float d, float pi) { this->r = r; this->d = d; this->pi = pi; } void get_tomon() { cout << r << " " << d << " " << pi << endl; } }; int main() { float r, d, pi; cout << "Sharning parametrlarini kiriting(r, d, pi): "; cin >> r >> d >> pi; Shar obj = Shar(r, d, pi); obj.setYP(); obj.getYP(); cout << "Yangi qiymatlarni kiriting: "; cin >> r >> d >> pi; obj.set_tomon(r, d, pi); cout << "Yangi qiymatlar uchun: \n"; obj.get_tomon(); obj.setYP(); obj.getYP(); { float r, d, pi; cout << "Yana Sharning parametrlarini kiriting(r, d, pi): "; cin >> r >> d >> pi; Shar obj = Shar(r, d, pi); obj.setYP(); obj.getYP(); cout << "Yana Yangi qiymatlarni kiriting: "; cin >> r >> d >> pi; obj.set_tomon(r, d, pi); cout << "Yana Yangi qiymatlar uchun: \n"; obj.get_tomon(); obj.setYP(); obj.getYP(); } } Javob: 2)Savol:
Kod:
ETIBORINDIZ UCHUN RAXMAT !!! Download 0.52 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling