#include “stdafx.h”
int add(int a,int b)
{
int answer;
printf(“两数之和为:”);
scanf_s("%d",&answer);
if(a+b==answer)
return 1;
else
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
int a,b,i,c;
printf(“请输入两个加数,中间用+连接:”);
scanf_s("%d+%d",&a,&b);
c=add(a,b);
for(i=1;;i++)
{
if(c==1)
{
printf(“Right!\n”);
break;
}
else
{
printf(“Not correct! Try again!\n”);
c=add(a,b);
}
}
}