试试这个: #include<stdio.h> main() {int a=1,b=1,c; loop:printf("%d+%d=",a,b); scanf("%d",&c); if(c!=a+b) {printf("wrong\n");goto loop;} else printf("yes\n"); getch(); } |

试试这个: #include<stdio.h> main() {int a=1,b=1,c; loop:printf("%d+%d=",a,b); scanf("%d",&c); if(c!=a+b) {printf("wrong\n");goto loop;} else printf("yes\n"); getch(); } |

2004-09-01 17:36
2004-09-01 17:38
2004-09-01 17:47
2004-09-01 17:48
如果是
pig+silly
答案为hanchao
该怎么写
2004-09-01 17:54
很简单的,但我有个函数忘了怎么写,字符串比较函数,这样写比较麻烦:
#include<stdio.h>
#include<string.h>
main()
{char a[7]={"hanchao"},b[7]; int i;
loop:printf("pig+silly=");
scanf("%s",b);
for(i=0;i<strlen(b);i++)
if(a[i]==b[i]) continue;
else break;
if(i!=7) {printf("wrong\n");goto loop;}
else printf("yes\n");
getch();
}
[此贴子已经被作者于2004-09-01 18:05:14编辑过]

2004-09-01 18:04
2004-09-01 18:08
2004-09-01 18:10
getch(); 这是什么意思?
2004-09-01 21:38
2004-09-02 00:05