| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么这个程序用GCC不过,而C++就过了呢????#include<iostream>
using namespace std;
char number[1000];
int root,i,temp;
int main()
{
while(cin>>number&&number[0]!='0'){
root=0;
for(i=0;number[i];i++)
root+=number[i]-'0';
while(root>9){
temp=root;
root=0;
while(temp)
root+=temp%10,temp/=10;
}
cout<<root<<endl;
}
return 1;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator