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 |
哪位大哥可以帮忙看一下吗,老找不到错#include <iostream.h> void main() { int i; char num[12]; char add[12]; int temp; cin>>num; while(cin) { cin>>add; // if(add[0]=='-') //自我测试时使用 // break; for(i=0;num[i]!='\0';i++) //字符数组元素相加 num[i]=num[i]+add[i]-'0'; for(i=0;num[i]!='\0';i++)//和大于10时 { temp=num[i]-'0'; temp=temp%10; num[i]=temp+'0'; } } cout<<num; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator