个性化背词软件 更新ing(9-4)
生活随笔
收集整理的這篇文章主要介紹了
个性化背词软件 更新ing(9-4)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1 #include<stdio.h>
2 #include<string.h>
3 #include<stdlib.h>
4
5 #define NUM 1000
6
7 struct VOC
8 {
9 char word[10];//單詞
10 char translation[60];// 翻譯
11 int whichDay;//哪一天背的
12 int correctNum;//正確次數(shù)
13 int wrongNum;//錯(cuò)誤次數(shù)
14 int passed;//是否通過
15 }voc[NUM];
16
17 int score[100];//成績
18 int time=0;//背誦天數(shù)
19
20 FILE *vocRead();
21 FILE *fileRead(int *,int *);
22 void check(int time);
23 void start();
24 int amounts=100;//測試使用
25
26 int main()
27 {
28 start();
29 time=1;
30 voc[159].whichDay=1;voc[658].whichDay=1;voc[237].whichDay=1;//進(jìn)行測試
31 check(time);
32 return 0;
33 }
34
35 FILE *vocRead()
36 {
37 FILE *fp;
38 fp=fopen("百次斬詞庫.txt","r");
39 if(fp==0)
40 {
41 printf("文件出錯(cuò),請(qǐng)檢查。");
42 exit(1);
43 }
44 fscanf(fp,"%s%s",&voc[0].word,&voc[0].translation);
45 for(int i=1;!feof(fp)&&i<NUM;i++)
46 {
47 fscanf(fp,"%s%s",&voc[i].word,&voc[i].translation);
48 }
49 fclose(fp);
50 }
51 //void recite(int time);
52 void check(int time)
53 {
54 int k=0;//檢查次數(shù)
55 float todayScore[200];
56 char input[10];
57 time=1;
58 for(int i=0;i<NUM;i++)
59 {
60 if(voc[i].whichDay==time)
61 {
62 printf("請(qǐng)輸入相應(yīng)的單詞:%s\n",voc[i].translation);
63 while(1)
64 {
65 if(k==7)
66 {
67 printf("\n%s",voc[i].word);
68 break;
69 }
70 scanf("%s",input);
71 if(strcmp(voc[i].word,input)==0)
72 {
73 voc[i].correctNum++;
74 if(voc[i].correctNum>=voc[i].wrongNum)
75 {
76 voc[i].passed=1;
77 todayScore[time]++;
78 break;
79 }
80 printf("輸入正確,你真棒!請(qǐng)?jiān)俅屋斎?#xff1a;");
81 }
82 else
83 {
84 printf("輸入錯(cuò)誤,請(qǐng)重新輸入:");
85 voc[i].wrongNum++;
86 }
87 k++;
88 }
89 }
90 }
91 todayScore[time]=todayScore[time]/amounts;
92 }
93
94 void displayFail(int time)
95 {
96 printf("單詞\t翻譯\n");
97 for(int i=0;i<NUM;i++)
98 {
99 if(voc[i].whichDay==time)
100 {
101 if(voc[i].passed==0)
102 {
103 printf("%s\t%s\n",voc[i].word,voc[i].translation);
104 }
105 }
106 }
107 }
108
109 void start()
110 {
111 printf("**********1.開始背詞**********\n");
112 printf("********2.設(shè)置背誦數(shù)量**********\n");
113 printf("**********3.檢查今天單詞**********\n");
114 printf("**********1.開始背詞**********\n");
115 printf("**********1.開始背詞**********\n");
116 printf("**********1.開始背詞**********\n");
117 printf("**********1.開始背詞**********\n");
118 printf("**********1.開始背詞**********\n");
119 char choice=getchar();
120 switch(choice)
121 {
122 case '1':;
123 // case '2':settings();break;
124 case '3':check(time);
125 }
126 }
127
128 FILE *fileRead(int *amounts,int *passedScore)
129 {
130 char nothing[30];
131 FILE *fp;
132 fp=fopen("詞庫數(shù)據(jù)管理","r+");
133 if(fp==0)
134 {
135 printf("文件出錯(cuò),請(qǐng)檢查。");
136 exit(1);
137 }
138 fscanf(fp,"%s%d%s%d%s",nothing,amounts,nothing,passedScore,nothing);
139 fscanf(fp,"%d%d%d%d",&voc[0].whichDay,&voc[0].correctNum,&voc[0].wrongNum,&voc[0].passed);
140 for(int i=1;!feof(fp)&&i<NUM;i++)
141 {
142 fscanf(fp,"%d%d%d%d",&voc[i].whichDay,&voc[i].correctNum,&voc[i].wrongNum,&voc[i].passed);
143 }
144 fclose(fp);
145 return fp;
146 }
?
轉(zhuǎn)載于:https://www.cnblogs.com/ncoheart/p/9582467.html
總結(jié)
以上是生活随笔為你收集整理的个性化背词软件 更新ing(9-4)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 429. N-ary Tree Leve
- 下一篇: iview area 遇到的坑