Sobirov og
ʻ
abek 110-21 – guruh
4-AMALIYOT ISHI
MAVZU
:
STACK,QUEUE,DEQUEUE(STEK,NAVBAT,DEK)
Variant-29
29. N ta elementdan tashkil topgan stek berilgan.stekning eng kichik elementini toping va bu
elementdan keyingi elementni o’chiring.
#include
#include
#include
using namespace std;
int main()
{
srand(time(NULL));
stack st,stt;
int a, min = 1000;
for ( int i=0; i<10; i++)
{
a = rand()%50;
if ( a < min)
min = a;
st.push(a);
stt.push(a);
}
while(
!
stt.empty()){
cout<stt.pop();}
cout<while(
!
st.empty()){
cout<if (st.top() == min)
st.pop();
st.pop();
}
}