Using namespace std; class toplam 1{
Download 128.76 Kb.
|
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< }
};
float t3; void show(){ cout< }
};
float newt; void show(){ cout< }
};
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"; t_1[i].show(); }
int k=0;
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"; t_2[i].show(); }
int m=0;
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"; t_3[i].show(); }
int l=0; bool a=false; for(int j=0; j a=a||(t_2[i].t2==t_3[j].t3); }
if(a==false){ l++;
}
for (int i=0; i for(int j=0; j b=b||(t_3[i].t3==t_2[j].t2);
}
if(b==false){ }
} 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; }
}
for(int i=0; i new_t[i].show();
}
2-misol…
using namespace std; struct kompyuter {
string firmasi;
int yadrosi;
};
void faylga_chiqarish(kompyuter t[], int n, string firma, int yadrosi, char fayl_nomi[]){ 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< }}}
int k=0;
if (t[i].firmasi == firma || t[i].yadrosi == yadros){ k=1;
cout< }
if(k==0){ }
void show(kompyuter t[], int n){ for (int i=0; i cout< }
}
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< }
}
int main () { int n;
cout<<"notebooklar sonini kiriting: "; kompyuter t[n]; input(t, n);
cout<<"\nnomi | firmasi | xotirasi (gb) | yadrosi | yili "< show(t, n);
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;
system("CLS"); switch(p){
case 1: { faylga_chiqarish(t, n , firma, yadrosi, "1.txt");
break;
case 2: { }
|
ma'muriyatiga murojaat qiling