自己写的:
#include<iostream>
#include<stack>
using namespace std;
int main()
{
long long a[10], b[10], c[10];
int length;
cin >> length;
for (int i = 0; i < length; i++)
{
cin >> a[i] >> b[i] >> c[i];
if ((a[i]+b[i])>c[i])
{
cout << "Case " << "#" << i + 1 << ": " << "true" << endl;
}
else
{
cout << "Case " << "#" << i + 1 << ": " << "false" << endl;
}
}
system("pause");
return 0;
}
大佬的:
#include <iostream>//C语言头文件换成#include <stdio.h>即可
using namespace std;
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
long long int a,b,c;
scanf("%11d%11d%11d",&a,&b,&c);
printf("Case #%d: %s\n",i+1,a+b>c?"true":"false");
}
return 0;
}