String nomi; string rangi


Download 12.67 Kb.
Sana25.04.2023
Hajmi12.67 Kb.
#1396321
Bog'liq
c 7-dekabr


№ 1.
#include
using namespace std;
class Avto{
public:
string nomi;
string rangi;
int yili;
int narxi;
};
class Avtouz:public Avto{
public:
string gaz;
string sifati;
};
class Avtoru:public Avto{
public:
int tezligi;

};
int main(){
Avtouz a1;
a1.nomi="Cobalt ";
a1.rangi="Oq ";
a1.narxi=130000000;
a1.yili=2022;
a1.gaz="metan ";
a1.sifati="Eror ";
cout< return 0;
}

№ 2.
#include


using namespace std;
//Vorislik mavzusi
class Avto{
public:
string nomi;
string rangi;
int yili;
int narxi;
};
class Avtouz:public Avto{
public:
string gaz;
string sifati;
};
class AvtoGM:public Avtouz{
public:
int tezligi;
void kiritish(string n,string r,int t,string s){
nomi=n;
rangi=r;
tezligi=t;
sifati=s;
}
void chiqarish(){
cout< }
};
int main(){
AvtoGM a1;
a1.kiritish("Cobolt","qora",200,"Eror");
a1.chiqarish();
//a1.nomi="Cobalt ";
//a1.rangi="Oq ";
//a1.narxi=130000000;
//a1.yili=2022;
//a1.gaz="metan ";
//a1.sifati="Eror ";
//cout< return 0;
}

Download 12.67 Kb.

Do'stlaringiz bilan baham:




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