#include<iostream>#include<stack>usingnamespacestd;stringzhCN[]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};//正常记账范围内数值stringzhUNIT[]={"拾","佰","仟","万","拾","佰","仟","亿","拾","佰","仟","万","拾","佰","仟"};intmain(){//12,345,678,902while(1){charcc[32];scanf("%s",cc);stringstr_value(cc);cout<<"inputvalueis"<<str_value.c_str()<<endl;stack<int>nValue;for(inti=0;i<str_value.length();i++){constcharcc=str_value.at(i);nValue.push((cc-'0'));}stack<string>cn;intii=0;intzcount=0;while(!nValue.empty()){intvalue=nValue.top();cn.push(zhCN[value]);cn.push(zhUNIT[ii]);nValue.pop();ii++;}if(!cn.empty()){cn.pop();}//删除零stack<string>cn2;while(!cn.empty()){while(cn.top()!=zhCN[0]){cn2.push(cn.top());cn.pop();if(cn.empty()){break;}}if(cn.empty()){break;}//找到零结束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();}//找到零结束if(!cn.empty()){cn2.push(zhCN[0]);}}stack<string>cn3;stringnewstr="";while(!cn2.empty()){cn3.push(cn2.top());cn2.pop();}while(!cn3.empty()){newstr+=cn3.top();cn3.pop();}cout<<"newstris"<<newstr.c_str()<<endl;}return0;}