标签:string ref set cin -- 字符处理 problem problems include
[1002 写出这个数 (20分)](https://pintia.cn/problem-sets/994805260223102976/problems/994805324509200384)
#include<iostream>
#include<string>
using namespace std;
string name[10]={"ling","yi","er","san","si","wu"
,"liu","qi","ba","jiu"};
int main(){
string s; cin>>s;
int sum=0;
for(int i=0;i<s.length();i++){
sum+=s[i]-‘0‘;
}
string a=to_string(sum);
for(int i=0;i<a.length();i++){
if(i) cout<<" ";
cout<<name[a[i]-‘0‘];
}
return 0;
}
标签:string ref set cin -- 字符处理 problem problems include
原文地址:https://www.cnblogs.com/bingers/p/13074360.html