#include<iostream>
#include<conio.h>
using namespace std;
class kuyruk
{
private:
int tail,head;
int st[100];
int sayi;
public:
kuyruk()
{tail=0; head=0;}
void koy()
{
/*if(tail+1==head || (tail==(100-1) && !head))
return -1;*/
cout<<"sayi giriniz...>>\n";
cin>>sayi;
st[tail]=sayi;
tail++;
if(tail==100)
tail=0;
}
int al()
{
if(head==100)
head=0;
/*if(head==tail)
return -1;*/
head++;
st[head-1];
return st[head-1];
/*return 0;*/
}
};
int main()
{
kuyruk kyr1;
kyr1.koy();
kyr1.koy();
cout<<"1:"<<kyr1.al();cout<<endl;
cout<<"2:"<<kyr1.al();cout<<endl;
kyr1.koy();
kyr1.koy();
kyr1.koy();
kyr1.koy();
cout<<"3:"<<kyr1.al();cout<<endl;
cout<<"4:"<<kyr1.al();cout<<endl;
cout<<"5:"<<kyr1.al();cout<<endl;
cout<<"6:"<<kyr1.al();cout<<endl;
getch();
return 0;
}


Alıntı ile Cevapla
Bu Konuyu Paylaşın !