#include <bits/stdc++.h>
using namespace std;
int main() {
int piece=3,n=0,yes=0,no=0;
char m1_eng[piece][30]= {"apple","orange","banana"};
char m1_ch[piece][60]= {"苹果","橘子","香蕉"};
char input[30];
bool testing=true;
for(int i=0; i<piece; i++) {
printf("请输入%s的英文: ",m1_ch[i]);
testing=true;
n=strlen(m1_eng[i]);
for(int j=0; j<n; j++)
cin>>input[j];
for(int j=0; j<n; j++) {
if(input[j]!=m1_eng[i][j]) {
testing=false;
break;
}
}
if(testing) {
yes++;
} else {
no++;
}
}
cout<<"你答对了"<<yes<<"个单词, 答错了"<<no<<"个单词。"<<endl;
}
c++背英语单词程序
于 2023-07-07 14:09:27 首次发布