U E D R , A S I H C RSS

큐/조재화

No older revisions available

No older revisions available



스택과 아주아주 유사(두줄만 다름)
선택사양은 생략했음...
~cpp 

#include<iostream>
using namespace std;
void show_menu();
void push();
void pop();
void show_num();

int cho[10];
int i=0;
int main()
{
	show_menu();

	return 0;
}

void show_menu()
{
	cout<<"1.Push"<<"\t"<<"2. Pop"<<"\t"<<"3. 자료출력"<<endl;
	cout << "골라골라 : ";
	int choice;
	cin>>choice;
	switch(choice)
	{
	case 1: push();
		break;
	case 2: pop();
		break;
	case 3: show_num();
		break;
	}
}
void push()
{	
	cout<<"값을 입력해주세요 : ";
	int input;
	cin >> cho[i];
	i++;
	show_menu();
}
int d=0;
void pop()
{
	d++;
	show_menu();
}
void show_num()
{
	for(int j=d; j<i; j++)
	{
		cout<<cho[j]<<"\t";
	}
	cout<<endl;
	show_menu();
}


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:19
Processing time 0.0241 sec