Laboratoriya ishi. Yarimstatik ma’lumotlar tuzilmasi


Download 87.39 Kb.
Sana03.12.2020
Hajmi87.39 Kb.
#157561
Bog'liq
4-lab mta


O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI

Axborot xavfsizligi fakulteti 714-19 guruh talabasi Yoxshimov Mirjalol Odilbek o’g’li

  1. Laboratoriya ishi. YARIMSTATIK MA’LUMOTLAR TUZILMASI

23-variant

  1. Stek eng kichik elementi topilsin va uning o‘rniga 0 joylashtirilsin.

Dastur:

#include

#include

#include

using namespace std;

int main()

{

srand(time_t(NULL));

stack st;

stack s;

int n;

cout<<"Elementlar soni : ";

cin>>n;

for(int i=0, a; i

{

a= rand()% 100 + 1;

st.push(a);

s.push(a);

cout<

}

const int& k = s.top();

int min=k;

for(int i=0; i

{

if(st.top() < min ) min = s.top();

s.pop();

}

cout<< "min="<

for(int i=0; i

{

if(st.top() == min)

{

st.top()=0;

s.push(st.top());

st.pop();

continue;

}

s.push(st.top());

st.pop();

}

n= s.size();

cout << "\n\nNatija:\n";

for(int i=0; i

{

cout<

s.pop();

}

system("pause");

return 0;



}


Download 87.39 Kb.

Do'stlaringiz bilan baham:




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