Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include<iostream.h>
  2. #include<conio.h>
  3.  
  4. //Created By Krisna Anggara
  5.  
  6. #define n 10
  7.  
  8. void main()
  9. {
  10.     int S[n];
  11.     int x,top;
  12.  
  13.     top=-1;
  14.  
  15.     while (top<=n-1)
  16.     {
  17.         cout<<"Inputkan isi stack : ";
  18.         cin>>x;
  19.         top=top+1;
  20.         S[top]=x;
  21.     }
  22.  
  23.     cout<<"Isi stack : "<<endl;
  24.     while (top>=0)
  25.     {
  26.         x=S[top];
  27.         cout<<x<<" ";
  28.         top=top-1;
  29.     }
  30.  
  31.   getch();
  32. }