Fanalar haqida (nomi, chilar soni, chilar soni va o’zlashtira olmaganlar soni) to’plam berilgan


Download 42.92 Kb.
Sana18.06.2023
Hajmi42.92 Kb.
#1577559
Bog'liq
4.lab.sardorbek


11.Fanalar haqida (nomi, 5 chilar soni, 4 chilar soni, 3 chilar soni va o’zlashtira olmaganlar soni) to’plam berilgan. Fanlarni nomi, o’qituvchi_FIO, 5 chilar soni, 4 chilar soni, 3 chilar soni va o’zlashtira olmaganlar soni bo’yicha qidiruvchi hamda topilgan natijani faylga saqlashni taklif qiladigan dastur tuzing.

11.#include


#include
#include
#include
using namespace std;
int main(){
int n; bool t=false;
cout<<"Fanlar sonini kiriting: "; cin>>n;
multimap M, M2;
for (int i = 0; i < n; i++){
string FIO;
int beshchi;
int tortchi;
int uchchi;
int ikkichi;
cout<cout<<" nomi: ";
string nomi;
cin>>nomi;
FIO = nomi;
cout<<"Beshchilar: "; cin>>beshchi;
cout<<"Tortchilar: "; cin>>tortchi;
cout<<"Uchchilar: "; cin>>uchchi;
cout<<"Ikkichilar: "; cin>>ikkichi;
M.insert(pair(FIO,beshchi));
}
string S, W, R, T;
int N;
int U;
int F;
int G;
cout<<"Qaysi fandan beshchilar kerak?:";
cin>>N;
int k=0;
multimap :: iterator it;
for ( it = M.begin(); it != M.end(); ++it){
S = it->first;
if(S.find(" ")second == N){
M2.insert(pair(S,N));t=true;}
}
cout<<"Qaysi fandan tortchilar kerak?:";
cin>>U;
int l=0;
multimap :: iterator ti;
for ( ti = M.begin(); ti != M.end(); ++ti){
W = it->first;
if(W.find(" ")second == U){
M2.insert(pair(W,U));t=true;}
}
cout<<"Qaysi fandan uchchilar kerak?:";
cin>>F;
int b=0;
multimap :: iterator et;
for ( et = M.begin(); et != M.end(); ++et){
R = it->first;
if(R.find(" ")second == F){
M2.insert(pair(R,F));t=true;}
}
cout<<"Qaysi fandan ikkichilar kerak?:";
cin>>G;
int j=0;
multimap :: iterator ut;
for ( ut = M.begin(); it != M.end(); ++ut){
T = it->first;
if(T.find(" ")second == G){
M2.insert(pair(T,G));t=true;}
}
if(t){
cout<<"bor"<cout<<"Natijani faylga chiqaramizmi? y/n \n";
char t;
cin>>t;
if(t=='y'){
ofstream fout("natija.txt");
for ( it = M2.begin(); it != M2.end(); ++it){
fout<first<<" "<second<}
cout<<"Natijalar namuna.txt fayliga yuborildi!\n";
}
else {
for ( it = M2.begin(); it != M2.end(); ++it){
cout<first<<" "<second<}
}
} else cout<<"yo'q";}

Download 42.92 Kb.

Do'stlaringiz bilan baham:




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