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