#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int t; cin >> t;
for (int i = 1; i <= t; i++)
{
int wynik = getchar() - 48;
int a;
while (a = getchar())
{
if (a == '+')
{
int liczba = getchar() - 48;
wynik += liczba;
}
else if (a == '-')
{
int liczba = getchar() - 48;
wynik -= liczba;
}
else if (a == 13)
break;
}
cout << wynik << endl;
}
system("pause");
return 0;
}
http://pl.spoj.com/problems/PTWPZ083/
Dlaczego mój program nie wykrywa entera jako warunku wyjścia z pętli while? Enter ma znak ASCII 13 z tego co sprawdziłem.