Toshkent axborot texnologiyalari universiteti "algoritmlarni loyihalash" fanidan


Download 338.93 Kb.
Sana03.06.2020
Hajmi338.93 Kb.

O’ZBEKISTON RESPUBLIKASI ABOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI

TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

“ALGORITMLARNI LOYIHALASH” FANIDAN

4 – LABORATORIYA ISHI


GURUH: CAL011

BAJARDI: M ustoqov Ulug’bek

TOSHKENT – 2020

4Laboratoriya ishi

Mavzu: Ustuvor navbatlar ustida bajariladigan amallar.

13- variant


  1. Ixtiyoriy dasturlash tilida Priority Queue strukturaga ega bo’lgan studentlar massivi ifodalovchi dastur tuzing. Ustuvorlikni student ismini bosh hariflari bo’yicha ifodalang.

  2. Ixtiyoriy dasturlash tilida Priority Queue strukturaga ega bo’lgan studentlar massivi ifodalovchi dastur tuzing. Ustuvorlikni student familyasini bosh hariflari bo’yicha ifodalang.

  3. Ixtiyoriy dasturlash tilida Priority Queue strukturaga ega bo’lgan studentlar massivi ifodalovchi dastur tuzing. Ustuvorlikni student yoshi bo’yicha ifodalang.

  4. Ixtiyoriy dasturlash tilida Priority Queue strukturaga ega bo’lgan studentlar massivi ifodalovchi dastur tuzing. Ustuvorlikni student tug’ilgan yili bo’yicha ifodalang.

  5. Ixtiyoriy dasturlash tilida Priority Queue strukturaga ega bo’lgan studentlar massivi ifodalovchi dastur tuzing. Ustuvorlikni student tug’ilgan oyi bo’yicha ifodalang.

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

Dasturi:

#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;

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 338.93 Kb.

Do'stlaringiz bilan baham:




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