c 语言中Divide error 是什么意思 如何处理?

来源:百度知道 编辑:UC知道 时间:2024/05/15 13:24:38

divide是除数运算呀!除数为0了
你看看你的程序里有没用除数运算呀!除数不能为0

不过也有很多没有用除数运算的也会出现

#include <iostream.h>
#include <stdlib.h>

rand_data(int i,int j, int x,int y)
{
if((i+j+x+y)==24)
{
cout<<"a+b+c+d=24";
return 1;
}
if(((i+j)/x)*y==24)
{
cout<<"((a+b)/c)*d=24";
return 1;
}
if(i*j-x-y==24)
{
cout<<"a*b-c-d=24";
return 1
;
}
return -1;
}

void main()
{
int a,b,c,d,i;
while(1)
{
srand(time(0));
a=rand()%10;
b=rand()%10;
c=rand()%10;
d=rand()%10;
i=rand_data(a,b,c,d);
if(i==1)
break;
}
}

你分析下看哪里的问题呀

Divide error 驱动错