我的定义为
int totalnum;
int totalseconds;
totalnum是计数的,totalseconds是我得出的用时秒数
m_npower=totanum / totalseconds;
m_npower是我定义的一个Edit控件的整型变量 int m_npower;
为什么运行起来会错误?
有什么方法让这两个量相除吗,我需要得到他们的除数。高手指教!
int totalnum;
int totalseconds;
totalnum是计数的,totalseconds是我得出的用时秒数
m_npower=totanum / totalseconds;
m_npower是我定义的一个Edit控件的整型变量 int m_npower;
为什么运行起来会错误?
有什么方法让这两个量相除吗,我需要得到他们的除数。高手指教!
m_npower= totanum / totalseconds; //得出的是商
}
若
m_fpower定义成Edit控件的float型变量;
if(totalseconds>0){
m_fpower= totanum*1.0 / totalseconds; //得出的是商+余数
}
{
int qtit=0;
try
{
qtit=divsor/divend;
}
catch(...)
{
printf("divend is by zero !\n");
}
return qtit;
}
void main(void)
{
printf("%d\n",Divide(6,2));
}