Return max tezlik2*250


Download 42.85 Kb.
Sana05.01.2022
Hajmi42.85 Kb.
#230438
Bog'liq
Dasturlash Lab 13

    Bu sahifa navigatsiya:
  • Gurux

O’ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI

VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI

MUHAMMAD AL-XORAZMIY NOMIDAGI

TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI



Programming I(c++) fani bo’yicha

Gurux : 417-20

Bajardi : Solijonov D. Q.

Tekshirdi: Rustamova.M

  1. Topshiriq

Dastur:

#include

using namespace std;

class Avtomobil{

public:


string nomi;

int max_tezlik;

public:

virtual int narx1(){

return max_tezlik*100;

}

virtual int metodni_yangilash1(){



return max_tezlik+10;

}

void kirit(){



cout << " Nomi : "; cin>>nomi;

cout << " Max Tezligi : "; cin >> max_tezlik;

cout<< " --------------------------------------------------------- \n";

}

void chiqar(){



cout << " Nomi : " << nomi << endl;

cout << " Max Tezligi : " << max_tezlik << endl;

cout << " Narxi : " << narx1() << endl;

cout << " Metodni Yangilash : " << metodni_yangilash1() << endl;

cout << " ----------------------------------------------------- \n";

}

};



class Zamonaviy_Avtomabil :public Avtomobil{

public:


string nom;

int max_tezlik2;

public :

virtual int narx2(){

return max_tezlik2*250;

}

virtual int metodni_yangilash2(){



return max_tezlik2+25;

}

void chiqar(){



cout << " Nomi : " << nom << endl;

cout << " Max Tezligi : " << max_tezlik2 << endl;

cout << " Narxi : " << narx2() << endl;

cout << " Metodni Yangilash : " << metodni_yangilash2() << endl;

cout << " ----------------------------------------------------- \n";

}

};



int main(){

Avtomobil a[100];

Zamonaviy_Avtomabil b[100];

int n;

cout << " Avtomobillar soni : "; cin >> n;

for(int i=0; i

a[i].kirit();

a[i].narx1();

a[i].metodni_yangilash1();

b[i].nom = a[i].nomi;

b[i].max_tezlik2 = a[i].max_tezlik;

b[i].narx2();

b[i].metodni_yangilash2();

}

for(int i=0; i

for(int i=0; i

}


Natija:



Download 42.85 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling