Laboratoriya ishi


Download 351.45 Kb.
bet1/2
Sana25.05.2020
Hajmi351.45 Kb.
#109957
  1   2
Bog'liq
2 5283019729261299163
Ingliz tili 1 , “Мультимедиага кириш” фанидан мустақил иш мавзуларининг тақсимоти, Bluebells T F NG exercise, Оптика, (Copy) tarqatma 7, davlat tili, ozbek xalq dostonlarining chastotali izohli frazeologik lugati (1), Hayot faoliyati amaliy 1, Hayot faoliyati amaliy 1, 1, Diniy ek Mustaqil ish 9df737f9fd1887ea73741bb383e4cad7, Вазиятлми масала стом 210 Б МАС нинг текшириш усуллари, 2 sinfda takrorlash umumlashtirish darslarini tashkil etish metodikasi, Valeologiya ON

O'ZBЕKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI

TOSHKЕNT AXBOROT TЕXNOLOGIYALARI UNIVЕRSITЕTI

Algoritmlarni loyihalash” fanidan



LABORATORIYA ISHI

Mavzu: Ustuvor navbatlar ustida bajariladigan amallar.

Bajardi: Xaydarov Imom Ali

Tekshirdi:Karaxanova Shirina

Toshkent_2019



4 – Laboratoriya ishi bo’yicha variantlar:

  1. Variant .Ixtiyoriy dasturlash tilida Priority Queue strukturaga ega bo’lgan studentlar massivi ifodalovchi dastur tuzing. Ustuvorlikni student tug’ilgan kuni bo’yicha ifodalang.:

Dastur kodi:

#include

#include

#include

using namespace std;

struct talaba{

string ismi,familiyasi,oyi,kuni;

int ball,yili,yoshi;

};

struct IsmHarfi {

bool operator()(talaba const& p1, talaba const& p2)

{

return p1.ismi > p2.ismi;

}

};

struct FamHarfi {

bool operator()(talaba const& p1, talaba const& p2)

{

return p1.familiyasi > p2.familiyasi;

}

};

struct Yoshi {

bool operator()(talaba const& p1, talaba const& p2)

{

return p1.yoshi < p2.yoshi;

}

};

struct Yili {

bool operator()(talaba const& p1, talaba const& p2)

{

return p1.yili > p2.yili;

}

};

struct Oyi {

bool operator()(talaba const& p1, talaba const& p2)

{

return p1.oyi < p2.oyi;

}

};

struct Kuni {

bool operator()(talaba const& p1, talaba const& p2)

{

return p1.kuni < p2.kuni;

}

};

int main(){

priority_queue ,IsmHarfi> pq;

priority_queue ,FamHarfi> pq1;

priority_queue ,Yoshi> pq2;

priority_queue ,Yili> pq3;

priority_queue ,Oyi> pq4;

priority_queue ,Kuni> pq5;

talaba temp;

int n;

cout<<"Nechta talaba kirittasiz: ";cin>>n;

for(int i=0;i<3;i++)

{

cout<<"Ismi: ";cin>>temp.ismi;

cout<<"Familyasi: ";cin>>temp.familiyasi;

cout<<"Tug'ulgan yil,oy va kunni -> 1998 11 02 ko'rinishda kiriting: ";

cin>>temp.yili>>temp.oyi>>temp.kuni;

temp.yoshi=2020-temp.yili;

pq.push(temp);

pq1.push(temp);

pq2.push(temp);

pq3.push(temp);

pq4.push(temp);

pq5.push(temp);

}

cout<<"**********Ismi bo'yicha ustuvorlik******* \t\t ***********Familiya bo'yicha ustuvorlik*************\n";

while (!pq.empty())

{

auto i= pq.top();

auto j= pq1.top();

cout<<"Ismi: "<

cout<<"Familiyasi: "<

cout<<"Yoshi: "<

cout<<"Tugulgan: "<

pq.pop();

pq1.pop();

}

cout<<"\n**********Yoshi bo'yicha ustuvorlik******* \t\t ***********Yili bo'yicha ustuvorlik*************\n";

while (!pq2.empty())

{

auto i= pq2.top();

auto j= pq3.top();

cout<<"Ismi: "<

cout<<"Familiyasi: "<

cout<<"Yoshi: "<

cout<<"Tugulgan: "<

pq2.pop();

pq3.pop();

}

cout<<"\n**********Oyi bo'yicha ustuvorlik******* \t\t ***********Kuni bo'yicha ustuvorlik*************\n";

while (!pq4.empty())

{

auto i= pq4.top();

auto j= pq5.top();

cout<<"Ismi: "<

cout<<"Familiyasi: "<

cout<<"Yoshi: "<

cout<<"Tugulgan: "<

pq4.pop();

pq5.pop();

}

return 0;

}






Download 351.45 Kb.

Do'stlaringiz bilan baham:
  1   2




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