#include using namespace std; int main() { int *p = new int[10000]; int *q; q = p; int n; //INPUT USER int ctr; ctr = 0; //penghitung jumlah data do { cout << "\nMenu:\n1. Tambah\n2. Lihat\n3. Ambil\n4. Keluar\n"; cout << "Pilihan Anda: "; cin >> n; if (n == 1) //TAMBAH { if (p != NULL) { cout << "Masukkan bilangan yang mau ditambah: "; if (ctr == 0) { cin >> p[ctr]; cout << p[ctr] << " berhasil ditambah\n"; } else { int tmp = p[ctr - ctr]; cin >> p[ctr - ctr]; p[ctr] = tmp; cout << p[ctr - ctr] << " berhasil ditambah\n"; } ctr++; } } else if (n == 2) cout << "Bilangan paling depan adalah: " << p[0] << "\n"; //LIHAT else if (n == 3) //AMBIL { if (p != NULL) { for (int i = 0; i < ctr; i++) { //SWAP int t = p[i]; p[i] = p[i+1]; p[i+1] = t; // } ctr -= 1; } } } while (n != 4); //delete memory delete [] p; p = NULL; q = NULL; return 0; }