Muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti telekommunikatsiya texnologiyalari fakulteti



Download 144,9 Kb.
Sana13.01.2022
Hajmi144,9 Kb.
#355666

MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

TELEKOMMUNIKATSIYA TEXNOLOGIYALARI FAKULTETI

410-20 GURUH TALABASI

ABDURASHIDOV SUHROB


“MA’LUMOTLAR TUZILMASI VA ALGORITMLAR “


FANIDAN

5-amaliy mashg’ulot

Bajardi:Abdurashidov Suhrob.
Tekshirdi: Muminov S.

3.Navbatni juft o‘rinda turgan elementlari o‘chirilsin.

// C++ program to demonstrate

// the working of STL queue of pairs

#include

using namespace std;

// Print the current pair

void printPair(pair p)

{

// Gives first element from queue pair



int f = p.first;

// Gives second element from queue pair

int s = p.second;

cout << "(" << f << ", " << s << ") ";

}

// Print the Queue of Pairs



void showQueue(queue
> gq)

{

// Print element until the



// queue is not empty

while (!gq.empty()) {

printPair(gq.front());

gq.pop();

}

cout << '\n';



}

// Driver code

int main()

{

queue


> gq;

// Pushing elements inside

// the queue container

gq.push({ 10, 20 });

gq.push({ 15, 5 });

gq.push({ 1, 5 });

gq.push({ 5, 10 });

gq.push({ 7, 9 });

cout << "Queue of Pairs: ";

showQueue(gq);

// Prints size of queue

cout


<< "\nSize of Queue of Pairs: "

<< gq.size();

// Prints first element

// of queue container

cout << "\nFront of Queue of Pairs: ";

printPair(gq.front());

// Prints last element

// of queue container

cout << "\nBack of Queue of Pairs: ";

printPair(gq.back());

cout << "\n\nRemoving the Front pair\n";

gq.pop();

cout << "Current Queue of Pairs: ";

showQueue(gq);

return 0;



}


Download 144,9 Kb.

Do'stlaringiz bilan baham:




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish