c – 无法理解此程序中用于检查自动编号的错误?
发布时间:2020-12-16 10:25:00 所属栏目:百科 来源:网络整理
导读:int a = 0,b,c,e,n = 25;e = n;while(n!=0){ n=n/10; a++;}printf("%d",a);b = e * e;c = b % (pow(10,a));if(c==e) printf("automorphic"); 对于线 c=b%(pow(10,a)); 编译器显示错误: invalid operands of types `int' and `double' to binary `operator%'
int a = 0,b,c,e,n = 25; e = n; while(n!=0) { n=n/10; a++; } printf("%d",a); b = e * e; c = b % (pow(10,a)); if(c==e) printf("automorphic"); 对于线 c=b%(pow(10,a)); 编译器显示错误: invalid operands of types `int' and `double' to binary `operator%' 解决方法
pow返回一个double,你不能在双打上使用%.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |