U E D R , A S I H C RSS

스택/조재화

데블스캠프 2쨋날

드뎌 오늘 하나완성...
간단하게 완성~~~ ^^:
~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();
}
void pop()
{
	i--;
	show_menu();
}
void show_num()
{
	for(int j=0; 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:30:16
Processing time 0.0106 sec