运行vc时输入完数据后一回车结果显示,马上窗口就自动关闭了怎么办
#include<stdio.h>main(){inta=0,b=8,k=1;longxa=0,xb=0,x1=0,x2=0;printf("\nInputthenumb...
#include<stdio.h>
main()
{ int a=0,b=8,k=1;
long xa=0,xb=0,x1=0,x2=0;
printf("\n Input the number and weight a->b:");
scanf("%ld %d",&xa,&a,&b);
x1=xa;
while(x1!=0)
{ x2+=(x1%10)*k;
x1/=10;
k*=a;
}
k=1;
x1=x2;
while(x1!=0)
{xb+=(x1%b)*k;
x1/=b;
k*=10;
}
printf("\n %ld(%d)=%ld(%d)=%ld(%d)",xa,a,x2,10,xb,b);
} 展开
main()
{ int a=0,b=8,k=1;
long xa=0,xb=0,x1=0,x2=0;
printf("\n Input the number and weight a->b:");
scanf("%ld %d",&xa,&a,&b);
x1=xa;
while(x1!=0)
{ x2+=(x1%10)*k;
x1/=10;
k*=a;
}
k=1;
x1=x2;
while(x1!=0)
{xb+=(x1%b)*k;
x1/=b;
k*=10;
}
printf("\n %ld(%d)=%ld(%d)=%ld(%d)",xa,a,x2,10,xb,b);
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询