-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSTOS.cpp
More file actions
33 lines (31 loc) · 922 Bytes
/
STOS.cpp
File metadata and controls
33 lines (31 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int stos[10],i=-1; char d;
while (cin>>d) {
switch(d) {
case '+' : i++;
if (i<10) {
cin>>stos[i];
printf(":)\n");
} else {
printf(":(\n");
i--;
}
break;
case '-' : //i--;
if(i>=0) {
printf("%i\n",stos[i]);
i--;
} else {
printf(":(\n");
//i++;
}
break;
}
}
system("PAUSE");
return EXIT_SUCCESS;
}