简单题
View Code
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
using namespace std;
int a, b, c;
char st[50];
int make(char *st)
{
int len = strlen(st);
int ret = 0;
for (int i = len - 1; i >= 0; i--)
ret = ret * 10 + st[i] - '0';
return ret;
}
int main()
{
//freopen("t.txt", "r", stdin);
while (1)
{
scanf("%s", st);
char *st1 = strtok(st, "+");
char *st2 = strtok(NULL, "=");
char *st3 = strtok(NULL, "=");
a = make(st1);
b = make(st2);
c = make(st3);
if (a + b == c)
printf("True\n");
else
printf("False\n");
if (!(a | b | c))
break;
}
return 0;
}