|
Kommunikatsiyalarini rivojlantirish vazirligi muhammad al-xorazmiy nomidagi tooshkent axborot texnalogiyalari universiteti i-kurs
|
Sana | 14.06.2022 | Hajmi | 0,76 Mb. | | #667355 |
| Bog'liq 3-top
O’ZBKISTON RESPUBLIKASI AXBOROT TEXNALOGIYALARI VA
KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI TOOSHKENT AXBOROT
TEXNALOGIYALARI UNIVERSITETI I-KURS 211-21 GURUH
TALABASI ADHAMOV MUHAMMADSODIQNING BAJARGAN
2-MUSTAQIL ISHI
Bajardi: Adhamov Muhammadsodiq
Tekshirdi: Ishniyazov Odiljon
Toshkent-2022
1-topshiriq
#include
#include
using namespace std;
int main()
{
multiset M , M2, M3;
set S;
int n;
cin>>n;
for(int i=0; iM.insert(rand()%100-50);
}
for(auto a:M){
cout<}
cout<<"\n----------------------\n";
for(auto i=M.begin(); i!=M.end(); i++){
int x=*i;
S.insert(x);
if(x%2!=0){
M2.insert(x);
}
}
for(auto a:M2){
cout<}
cout<<"\n----------------------\n";
int soni=0;
for(auto i=S.begin(); i!=S.end();i++){
for(auto j=M.begin(); j!=M.end(); j++){
if(M.count(*i)){
if(*i==*j) {
soni++;
}
}
}
if(soni>0)cout<<*i<<" -"<else {cout<<*i<<" - qatnashmagan "<soni = 0;
}
return 0;
}
2-topshiriq
#include
using namespace std;
class Talaba{
public:
string ism;
string familiya;
string sharf;
int guruh;
int ball;
};
Talaba x[100];
map M5;
map M4;
map M3;
map M2;
istream &operator >> (istream &yoz, Talaba &x){
cout<<"familiya: "; cin>>x.familiya;
cout<<"ism: "; cin>>x.ism;
cout<<"sharf: "; cin>>x.sharf;
cout<<"guruh: "; cin>>x.guruh;
cout<<"ball: "; cin>>x.ball;
return yoz;
}
ostream &operator << (ostream &chiqar, Talaba &x){
chiqar<return chiqar;
}
int n;
void insert(){
int z;
cout<<" talabalar soni: "; cin>>z;
n=z;
for(int i=0 ; icout<cin >> x[i];
}
}
void sort_5(){
int c=0;
for(int i=0 ; iif(x[i].ball == 5){
c++;
M5.insert(pair(c, x[i]));
}
}
for(auto s:M5){
cout<}
}
void sort_4(){
int c=0;
for(int i=0 ; iif(x[i].ball == 4){
c++;
M4.insert(pair(c, x[i]));
}
}
}
void sort_3(){
int c=0;
for(int i=0 ; iif(x[i].ball == 3){
c++;
M3.insert(pair(c, x[i]));
}
}
}
void sort_2(){
int c=0;
for(int i=0 ; iif(x[i].ball == 3){
c++;
M2.insert(pair(c, x[i]));
}
}
}
int main()
{
int n;
Talaba m;
insert();
cout<<"tanlang!!! \n";
cout<<"1. id bo'yicha qidirish \n";
cout<<"2. ism bo'yicha qidirish \n";
cout<<"3. familiya bo'yicha qidirish \n";
cout<<"\n----------------- 5 ----------------------\n";
sort_5();
cout<<"\n----------------- 4 ----------------------\n";
sort_4();
cout<<"\n----------------- 3 ----------------------\n";
sort_3();
cout<<"\n----------------- 2 ----------------------\n";
sort_2();
}
Do'stlaringiz bilan baham: |
|
|