#include成都創(chuàng)新互聯(lián)是專業(yè)的赫山網(wǎng)站建設(shè)公司,赫山接單;提供成都網(wǎng)站建設(shè)、成都做網(wǎng)站,網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行赫山網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!#include using namespace std; string zhCN[] = {"零","壹","貳","叁","肆","伍","陸","柒","捌","玖"}; //正常記賬范圍內(nèi)數(shù)值 string zhUNIT[] = { "拾","佰","仟","萬","拾","佰","仟","億" ,"拾","佰","仟","萬", "拾","佰","仟"}; int main() { //12,345 ,678, 902 while (1) { char cc[32]; scanf("%s", cc); string str_value(cc); cout << "input value is " << str_value.c_str() << endl; stack nValue; for (int i = 0; i < str_value.length(); i++) { const char cc = str_value.at(i); nValue.push((cc - '0')); } stack cn; int ii = 0; int zcount = 0; while (!nValue.empty()) { int value = nValue.top(); cn.push(zhCN[value]); cn.push(zhUNIT[ii]); nValue.pop(); ii++; } if (!cn.empty()) { cn.pop(); } //刪除零 stack cn2; while (!cn.empty()) { while (cn.top() != zhCN[0]) { cn2.push(cn.top()); cn.pop(); if (cn.empty()) { break; } } if (cn.empty()) { break; } //找到零結(jié)束 while (cn.top() == zhCN[0]) { cn.pop(); if (cn.empty()) { break; } if (cn.top() == zhUNIT[3])//保留萬 { cn2.push(zhUNIT[3]); } if (cn.top() == zhUNIT[7])//保留億 { cn2.push(zhUNIT[7]); } cn.pop(); }//找到零結(jié)束 if (!cn.empty()) { cn2.push(zhCN[0]); } } stack cn3; string newstr = ""; while (!cn2.empty()) { cn3.push(cn2.top()); cn2.pop(); } while (!cn3.empty()) { newstr += cn3.top(); cn3.pop(); } cout << "newstr is " << newstr.c_str() << endl; } return 0; }
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。