#include<stdio.h>
void main()
{
int i=0,base,num[32];
long int n; char c;
printf("Input num:");
scanf("%ld",&n);
printf("Input base:");
scanf("%d",&base);
for(i=0;;i++)
{
if(n=0)
break;
num[i]=n%base;
n=n/base;
}
c=i;
for(i=0;i<c;i++)
printf("%f ",num[c-i]);
printf("\n");
}
将十进制转化为其他进制的问题
你的这种情况叫做 runtime error (运行时错误)。
在 Windows 7 上这样提示:
在 Windows XP 上这样提示:
runtime error (运行时错误)就是程序运行到一半,程序就崩溃了。
比如说:
①除以零
②数组越界:int a[3]; a[10000000]=10;
③指针越界:int * p; p=(int *)malloc(5 * sizeof(int)); *(p+1000000)=10;
④使用已经释放的空间:int * p; p=(int *)malloc(5 * sizeof(int));free(p); *p=10;
⑤数组开得太大,超出了栈的范围,造成栈溢出:int a[100000000]
还是不行。。
本回答被提问者采纳