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