日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

完美世界第二题:模拟读数字

發布時間:2025/6/15 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 完美世界第二题:模拟读数字 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

測試用例:

102:yibailinger

11:shiyi

1:yi

111:yibaiyishiyi

1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 /************************************************************************/ 5 /* 模擬讀數字 */ 6 /************************************************************************/ 7 void readNumber(const int &number) 8 { 9 string result=""; 10 vector<string> match(10); 11 match[0] = "ling";match[1] = "yi";match[2] = "er";match[3] = "san"; 12 match[4] = "si";match[5] = "wu";match[6] = "liu";match[7] = "qi"; 13 match[8] = "ba";match[9] = "jiu"; 14 int baiwei = number/100; 15 int shiwei = number%100/10; 16 int gewei = number%10; 17 if (baiwei != 0) 18 { 19 result = match[baiwei]; 20 result+="bai"; 21 if (shiwei != 0) 22 { 23 result+=match[shiwei]; 24 result+="shi"; 25 } 26 else 27 result+=match[shiwei]; 28 if (gewei != 0) 29 result+=match[gewei]; 30 } 31 else 32 { 33 if (shiwei != 0) 34 { 35 if(shiwei != 1) 36 result = match[shiwei]; 37 result+="shi"; 38 } 39 if (gewei != 0) 40 result+=match[gewei]; 41 } 42 for (int i=0;i<result.size();i++) 43 cout<<result[i]; 44 cout<<endl; 45 } 46 int main() 47 { 48 int number; 49 while(cin>>number) 50 readNumber(number); 51 system("pause"); 52 return 0; 53 }

?

轉載于:https://www.cnblogs.com/keleshaoye/p/5432983.html

總結

以上是生活随笔為你收集整理的完美世界第二题:模拟读数字的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。