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