Using namespace std; class toplam 1{


Download 128.76 Kb.
bet1/2
Sana06.05.2020
Hajmi128.76 Kb.
#103692
  1   2
Bog'liq
5-misol


1-misol…

#include

using namespace std;

class toplam_1{

public:

float t1;

void cin1(){

cin>>t1;

}

void show(){



cout<

}


};

class toplam_2{

public:

float t2;

void show(){

cout<

}

};

class toplam_3{



public:

float t3;

void show(){

cout<

}

};

class newtoplam{



public:

float newt;

void show(){

cout<

}

};

int main () {



toplam_1 t_1[100]; toplam_2 t_2[100]; toplam_3 t_3[100];

newtoplam new_t[100];

int n;

cout<<"Elementlar sonini kiriting: ";



cin>>n;

cout<<"Elementlarni kiriting: ";

for (int i=0; i

t_1[i].cin1();

}

cout<<"\n1-to'plamning elementlari: \n";



for (int i=0; i

t_1[i].show();

}

int k=0;


for (int i=0; i

for (int j=i+1; j

t_2[k].t2=t_1[i].t1+t_1[j].t1;

k++;


}

}

cout<<"\n\n2-to'plamning elementlari: \n";



for(int i=0; i

t_2[i].show();

}

int m=0;


for (int i=0; i

for (int j=i+1; j

t_3[m].t3=t_1[i].t1-t_1[j].t1;

m++;


}

}

cout<<"\n\n3-to'plamning elementlari: \n";



for(int i=0; i

t_3[i].show();

}

int l=0;



for (int i=0; i

bool a=false;

for(int j=0; j

a=a||(t_2[i].t2==t_3[j].t3);

}

if(a==false){



new_t[l].newt=t_2[i].t2;

l++;


}

}

for (int i=0; i

bool b=false;

for(int j=0; j

b=b||(t_3[i].t3==t_2[j].t2);

}

if(b==false){



new_t[l++].newt=t_3[i].t3;

}

}



for(int i=0; i

for(int j=i+1; j

if(new_t[i].newt

newtoplam temp = new_t[i];

new_t[i] = new_t[j];

new_t[j] = temp;

}

}

}



cout<<"\n\nyangi hosil bo'lgan to'plamning elementlari: \n";

for(int i=0; i

new_t[i].show();

}

}



2-misol…


#include

using namespace std;

struct kompyuter {

string nomi;

string firmasi;

int xotirasi;

int yadrosi;

int yili;

};

void faylga_chiqarish(kompyuter t[], int n, string firma, int yadrosi, char fayl_nomi[]){



ofstream yoz(fayl_nomi,ios::app);

for(int i=0 ;i

if (t[i].firmasi == firma || t[i].yadrosi == yadrosi){

yoz<<"nomi: "<

yoz<<"Firmasi: "<

yoz<<"xotirasi: "<

yoz<<"yadrosi: "<

yoz<<"yili: "<

yoz<

}}}


void search(kompyuter t[], int n, string firma, int yadros){

int k=0;


for (int i = 0; i < n; i++) {

if (t[i].firmasi == firma || t[i].yadrosi == yadros){

k=1;

cout<

}

}

if(k==0){



cout<

}


}

void show(kompyuter t[], int n){

for (int i=0; i

cout<

}

}

void input(kompyuter t[], int n){



for (int i=0; i

cout<

cin>>t[i].nomi;

cout<

cin>>t[i].firmasi;

cout<

cin>>t[i].xotirasi;

cout<

cin>>t[i].yadrosi;

cout<

cin>>t[i].yili;

cout<

}

}

void faylga_chiqarish(char fayl_nomi[]){



}

int main () {

int n;

cout<<"notebooklar sonini kiriting: ";



cin>>n;

kompyuter t[n];

input(t, n);

cout<<"\nnomi | firmasi | xotirasi (gb) | yadrosi | yili "<

show(t, n);

string firma;

int yadrosi;

cout<<"\n\nqidirilayotgan firma nomini va yadrosini kiriting: ";

cin>>firma;

cin>>yadrosi;

search(t, n, firma, yadrosi);

system("CLS");

cout<<"____________MENYU____________ \n";

cout<<"1. malumotlarni Faylga yozish \n";

cout<<"2. exit \n";

int p;


cin>>p;

system("CLS");

switch(p){

case 1: {

faylga_chiqarish(t, n , firma, yadrosi, "1.txt");

break;


}

case 2: {



exit;

}

}



return 0;

}


Download 128.76 Kb.

Do'stlaringiz bilan baham:
  1   2




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