标签:++ print for == col namespace eof ios lse
1 #include<iostream> 2 using namespace std; 3 4 int main(){ 5 int a, b; 6 while(scanf("%d%d", &a, &b) != EOF){ 7 int c = a + b; 8 if(c == 0) printf("0\n"); 9 else{ 10 if(c < 0){ 11 printf("-"); 12 c = -c; 13 } 14 int k[5]; 15 int cnt = 0; 16 while(c != 0){ 17 int x = c % 1000; 18 c /= 1000; 19 k[cnt++] = x; 20 } 21 for(int i = cnt-1; i >= 0; i--){ 22 if(i != cnt-1){ 23 printf("%03d", k[i]); 24 }else{ 25 printf("%d", k[i]); 26 } 27 if(i != 0) printf(","); 28 } 29 printf("\n"); 30 } 31 } 32 return 0; 33 }
标签:++ print for == col namespace eof ios lse
原文地址:https://www.cnblogs.com/findview/p/11632003.html