成语大全网 - 成语解释 - 用C++编写一个汉英词典,用二维数组存,差不多放10个20个词这样,自己放,然输入单词,输出它的汉

用C++编写一个汉英词典,用二维数组存,差不多放10个20个词这样,自己放,然输入单词,输出它的汉

#include<iostream>

using?namespace?std;

int?main()

{

char?ch[5][20]={"hello","nice","fighting","goal","fun"};

char?chi[5][20]={"你好","漂亮","加油","目标","有趣"};

char?str[20];

cout<<"请输入一个英文单词:";

cin>>str;

for(int?i=0;i<5;i++)

{

if(strcmp(ch[i],?str)?==?0)

cout<<"中文翻译:"<<chi[i]<<endl;

}

return?0;

}