Using namespace std; class eshik{


Download 159.05 Kb.
bet1/2
Sana28.04.2020
Hajmi159.05 Kb.
  1   2

1)

#include

using namespace std;

class eshik{

public:

string name="Eshik";

string firma;

string material;

float razmer_eni;

float razmer_buyi;

int narx;

void show1(){

cout<

}

friend void qidirish1(eshik z[100], int n ,string nom);



friend void saralash1(eshik z[100], int n);

};

class deraza{



public:

string name="Deraza";

string firmasi;

string materiali;

float razmeri_eni;

float razmeri_buyi;

int narxi;

void show2(){

cout<

}

friend void saralash2(deraza z[100], int n);



friend void qidirish2(deraza z[100], int n ,string nom);

};


void qidirish1(eshik z[100],int n, string nom){

bool bor=false;

cout<<"\nMahsulot nomi | firmasi | materiali | razmeri(sm) | narxi(sum) \n";

for(int i=0; i

if(z[i].firma==nom){

bor=true;

z[i].show1();

} if(!bor){

cout<<"Bu firma eshiklari ro'yhatda yo'q\n\n";

}

}



}

void qidirish2(deraza z[100],int n, string nom){

bool bor=false;

for(int i=0; i

if(z[i].firmasi==nom){

bor=true;

z[i].show2();

} if(!bor){

cout<<"\nBu firma derazalari ro'yhatda yo'q\n";

}

}



}

void saralash1(eshik z[100], int n){

cout<<"mahsulot nomi va firma nomi bo'yicha saralash: \n";

for(int i=0; i

for(int j=0; j

if(z[i].firma.compare(z[j].firma)<0){

eshik temp=z[i];

z[i]=z[j];

z[j]=temp;

}

}



}

for(int i=0; i

z[i].show1();

}

}



void saralash2(deraza z[100], int n){

for(int i=0; i

for(int j=0; j

if(z[i].firmasi.compare(z[j].firmasi)<0){

deraza temp=z[i];

z[i]=z[j];

z[j]=temp;

}

}



}

for(int i=0; i

z[i].show2();

}

}



int main () {

cout<<"mahsulotlar sonini kirirtng: ";

int n;

cin>>n;


eshik a[n]; deraza b[n];

for(int i=0; i

cout<

cin>>a[i].firma;

cout<

cin>>a[i].material;

cout<

cin>>a[i].razmer_eni;

cin>>a[i].razmer_buyi;

cout<

cin>>a[i].narx;

}

cout<<"\n_______________________________________________\n";



for(int i=0; i

cout<

cin>>b[i].firmasi;

cout<

cin>>b[i].materiali;

cout<

cin>>b[i].razmeri_eni;

cin>>b[i].razmeri_buyi;

cout<

cin>>b[i].narxi;

}

cout<<"\n____________________________________________________________\n";



cout<<"\nMahsulot nomi | firmasi | materiali | razmeri(sm) | narxi(sum) \n";

for(int i=0; i

a[i].show1();

b[i].show2();

}

cout<<"\n____________________________________________________________\n";



cout<<"qidirilayotgan mahsulotning firmasi nomini kiriting: ";

string nom;

cin>>nom;

qidirish1(a,n,nom);

qidirish2(b,n,nom);

cout<<"\n____________________________________________________________\n";

saralash1(a,n);

saralash2(b,n);



}

2)

#include



#include

using namespace std;

class tovar {

public:


string name;

int ishlab_yil;

int narxi;

int s;


int m;

string chiqindi;

void show() {

cout<

}

void show_tovarlar(){



cout<

}

void chiqit(){



if(2020-ishlab_yil>m){

chiqindi="muddati o'tgan!";

} else {

chiqindi="";

}

show_tovarlar();



}

void chiqitsiz(){

if(2020-ishlab_yil

show();


}

}

};



class firma_tovari :public tovar{

public:


string name_;

int narxi_;

int ishlab_yil_;

int soni;

int saqlash_mud;

};

int main(){



int n;

cout<<"Tovarlar sonini kiriting: ";

cin>>n;

firma_tovari a[n];

for(int i=0; i

cout<<"Tovar nomi: ";

cin>>a[i].name_;

a[i].name=a[i].name_;

cout<<"Tovar narxi: ";

cin>>a[i].narxi_;

a[i].narxi=a[i].narxi_;

cout<<"Ishlab chiqarilgan yili: ";

cin>>a[i].ishlab_yil_;

a[i].ishlab_yil=a[i].ishlab_yil_;

cout<<"Tovar soni: ";

cin>>a[i].soni;

a[i].s=a[i].soni;

cout<<"Tovar yaroqlilik muddati: ";

cin>>a[i].saqlash_mud;

a[i].m=a[i].saqlash_mud;

cout<

}

cout<<"\n______________________________________________________________________________________\n";



cout<<"Barcha tovarlar haqidagi malumotlar: \n";

cout<<"\nNomi | narxi(sum) | soni | saqlash muddati(yil) | ishlab chiqarilgan yil| holati \n";

for(int i=0; i

a[i].chiqit();

}

cout<<"\n______________________________________________________________________________________\n";



cout<<"Yaroqli tovarlar haqidagi malumotlar: \n";

cout<<"\nNomi | narxi(sum) | soni \n";

for(int i=0; i

a[i].chiqitsiz();



}

}

3)

#include


Download 159.05 Kb.

Do'stlaringiz bilan baham:
  1   2




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