큐
~cpp #include <iostream> using namespace std; void menu(); void push(); void pop(); void show(); void exit(); int arr[10]; int i=0; int k=0; int main() { menu(); return 0; } void menu() { cout << "큐입니다.\n" "1. 추가 2. 삭제 3. 보여주기 4. 끝내기 \n" "원하는 번호 선택 : "; int input; cin >> input; switch(input) { case 1: push(); break; case 2: pop(); break; case 3: show(); break; case 4: exit(); break; } } void push() { cout << "추가할 값 입력: "; cin >> arr[i]; cout << arr[i] << "추가" << endl; i++; menu(); } void pop() { cout << arr[k] << "를 삭제합니다" << endl; k++; menu(); } void show() { for(int j=i-1; j>=k; j--) cout << arr[j] << endl; menu(); } void exit() { return; }