【发布时间】:2020-03-25 15:51:41
【问题描述】:
我是编程新手,我正在尝试修改这个程序,以便我可以输入猜测,直到我想停止。任何帮助都会很棒!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
char name[10][20]= {"DUMBO","MICKEY MOUSE","GOOFY","DONALD DUCK"};
char charName[20];
int count;
char found;
printf("Enter the name of a Disney cartoon character ");
gets(charName);
strupr (charName);
found = 'n';
for (count=0;count<4;count++)
{ if(!strcmp(charName, name[count]))
{found = 'y';}
}
if(found == 'y')
puts("Match");
else
puts("No Match");
system("pause");
return;
}
【问题讨论】:
-
你必须把gets和条件if found=='y'放在你的循环中
标签: dev-c++