Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include<cstdio>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int tab[10],i=0,n;
  7.     char c;
  8.    
  9.     while (cin >> c  )
  10.     {
  11.           if (c=='+')
  12.           {
  13.                      cin >> n;
  14.                      if (i<10)
  15.                      {
  16.                               cout << ":)" << endl;
  17.                               tab[i]=n;
  18.                               i++;
  19.                      } else
  20.                      cout << ":(" << endl;
  21.           }
  22.           if (c=='-')
  23.           {
  24.                      if (i>0) { i--; cout << tab[i]<< endl;  }  else
  25.                      if (i<=0) cout << ":("<< endl;;
  26.           }
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement