怎么样才能正确运行?

owenszp 2002-04-09 09:47:56
#include <stdio.h>
#include <math.h>
main()
{double a=2.00,b=4.00,c;
c=pow(a,b);
c=100.00%c;
printf("%lf",c);
}
...全文
37 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
neptunez 2002-04-10
  • 打赏
  • 举报
回复
% 整数
prototype 2002-04-10
  • 打赏
  • 举报
回复
the above posts are correct. namely, operator '%' is for
integral types (int, char, short, long, maybe bool).

for your problem, the correct thing you should use is 'fmod'

example:

#include <math.h>

...

c=fmod(100.00 , c); // 'c' gets the remainder of 100.0
// divided by 'c'.
ddszhan 2002-04-10
  • 打赏
  • 举报
回复
%的两个操作数一定是定点型的,如整型,字符型等。

69,368

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧