编写程序,将某一个输入位数不确定的正整数按照标准的三位分节格式输出,如输入82668634时,程序输出82,

日期:2013-12-18 15:04:49 人气:1

编写程序,将某一个输入位数不确定的正整数按照标准的三位分节格式输出,如输入82668634时,程序输出82,

cout>num;itoa(num,ch,10); cout0)) cout #include #include using namespace std;int main(){int num;string str; strstream s; cout>num;s>str;for(int i=0;i<str.length();i++){if(i%4==0){str.insert(i,",");}}str.erase(0,1);
    A+
热门评论