谷歌翻译

程序翻译

代码:
#include
#include
using namespace std;//对应字符
string NUMBER[] = {"","one ","two ","three ","four ","five ","six ","seven ","eight ","nine ","ten ","eleven ","twelve ","thirteen ","fourteen " ,"fifteen ","sixteen ","seventeen ","eighteen ","nineteen "};string NUMBERtwo[] = {"","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"};class MyBot
{
public:void putinfo(int a);//读法private:char name[25];char type[25];
};//打印信息
void MyBot::putinfo(int a)
{int b = a % 100;//翻译1000以内的数if (a/100 != 0){cout << NUMBER[a / 100] << "hundred ";if (b!=0){cout << "and ";}}if (b < 20){cout << NUMBER[b];}else{cout << NUMBERtwo[b / 10];if (b%10 != 0){cout << "\b-" << NUMBER[b % 10];}}}int main() {int number;cout << "请输入要翻译的数字:";cin >> number;MyBot bot;bot.putinfo(number);return 0;
}```