不好意思,貌似要在函数playgame下添加一个right=0;不然程序会一直累计right数目
包括程序及txt文档,希望可以对您有所帮助
#include #include #include #include #include #include
#include
void OpenWordFile(char string[21][11]); void PlayGame(char wordlist[21][11]);
void Change(char wordlist[21][11],char str[21][11]); void StartGame (char wordlist[21][11]); int guesstime=10; int round;
void Set() { printf("请输入您想猜的单词数:"); } {
char name[20]; int right; int wrong; int time;
scanf("%d",&round);
struct Player
};
typedef struct Player Player;
Player
p[5]={{1,"unknown",0,0,0},{2,"unknown",0,0,0},{3,"unknown",0,0,0},{4,"unknown",0,0,0},{5,"unknown",0,0,0}}; Player temp;
int right=0,wrong=0;
void OpenWordFile (char string[21][11]) {
FILE *fp; char c; int i=0;
int j=0;
if((fp=fopen("word.txt","r"))==NULL) //读文件 { printf("单词库无法打开!\n");
exit(0);