fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int stos[9];
  6. int i=0;int rozmiar=10;
  7. int j=rozmiar-1;
  8.  
  9. char c;
  10. while(cin>>c)
  11. {
  12.  
  13. switch(c)
  14. {
  15. case '+':
  16. if(i<rozmiar)
  17. {
  18. cin>>stos[i];
  19.  
  20.  
  21. i++;
  22. cout<<":)"<<endl;
  23. }
  24. else if(i>=rozmiar)
  25. {
  26. cout<<":("<<endl;
  27. }
  28. break;
  29. case '-':
  30. if(j>=0)
  31. {
  32. cout<<stos[j]<<endl;
  33. j--;
  34. }
  35. else
  36. {
  37. cout<<":("<<endl;
  38. }
  39. break;
  40. }
  41. }
  42.  
  43. return 0;
  44. }
Success #stdin #stdout 0s 15232KB
stdin
+ 1 + 2 + 3 + 4 + 5 + 6 + 5 + 7+ 9 + 0 +2 - - - - - - - - - - -
stdout
:)
:)
:)
:)
:)
:)
:)
:)
:)
:)
:(
0
9
7
5
6
5
4
3
2
1
:(