#include <stdio.h>
int a,b,result,chance;
int main()
{
void judge(int result,int chance);
int add(int a ,int b);
printf("请输入两个整数:");
scanf("%d%d",&a,&b);
chance=0;
do
{
result=add(a,b);
chance++;
judge(result,chance);
}while((result==0)&&(chance<3));//do while语句中的判断条件有多个时要用()分割开来,末尾的;不要忘了
}

void judge(int result,int chance)
{
if(result)
printf("Right!\n");
else if(chance<3)
printf("Not correct! Try again!\n");
else
printf("Not correct! You have tried three times! Test over!\n");
}

int add(int a,int b)
{
printf("请输入两数之和:");// 从键盘获取result的值的时候不能从主函数里获得
scanf("%d",&result);
if(a+b==result)
return 1;
else
return 0;
}