acm题为什么输出一直为0啊CXB join an interview,the interviewer give him a problem.He is asked to reverse every number and calculate the summation of the new number.For instance,there are two numbers 10 and 14,the answer after reverse is 1 an

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 17:59:26
acm题为什么输出一直为0啊CXB join an interview,the interviewer give him a problem.He is asked to reverse every number and calculate the summation of the new number.For instance,there are two numbers 10 and 14,the answer after reverse is 1 an

acm题为什么输出一直为0啊CXB join an interview,the interviewer give him a problem.He is asked to reverse every number and calculate the summation of the new number.For instance,there are two numbers 10 and 14,the answer after reverse is 1 an
acm题为什么输出一直为0啊
CXB join an interview,the interviewer give him a problem.He is asked to reverse every number and calculate the summation of the new number.For instance,there are two numbers 10 and 14,the answer after reverse is 1 and 41,so the final answer is 1+41=42.
Input
The first line of the input contains n.(nx>>y;
while(x>0)
{
x=x/10;
n=n+1;
}
for(j=n;j>0;j--)
{
a=x%10;
b=b+a*(10^(j-1));
x=x/10;
}
while(y>0)
{
y=y/10;
m=m+1;
}
for(j=m;j>0;j--)
{
a=y%10;
c=c+a*(10^(j-1));
y=y/10;
}
d=c+b;
cout

acm题为什么输出一直为0啊CXB join an interview,the interviewer give him a problem.He is asked to reverse every number and calculate the summation of the new number.For instance,there are two numbers 10 and 14,the answer after reverse is 1 an
#include
using namespace std;
int main()
{
int x,y,N,i,j,n=0,b=0,c=0,d,a,m=0;
cin>>N;
for(i=1;i>x>>y;
while(x>0)
{
x=x/10;
n=n+1;
}
for(j=n;j>0;j--)
{
a=x%10;
b=b+a*(10^(j-1));//^并不是表示次方
x=x/10;
}
while(y>0)
{
y=y/10;
m=m+1;
}
for(j=m;j>0;j--)
{
a=y%10;
c=c+a*(10^(j-1));
y=y/10;
}
d=c+b;
couty;
x=chang(x);
 y=chang(y);
 d=x+y;
cout