怎么了? [英] what's wrong?

查看:61
本文介绍了怎么了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include< stdio.h>

#include< math.h>

int main()

{long int x,y;


printf(输入一个整数\ n);

scanf("%d",& x);


y = x%pow(10,3);


printf(结果是%d,y);


返回0;}


编译器告诉我pow有问题,但是我

不知道什么是错的?

# include <stdio.h>
# include <math.h>
int main()
{ long int x,y;

printf("enter an integer\n");
scanf("%d",&x);

y=x%pow(10,3);

printf("the result is %d",y);

return 0;}

The compiler tell me there is something wrong with the "pow",but I
don''t know what''s the wrong?

推荐答案

问题写道:
questions wrote:

#include< stdio.h>

#include< math.h>

int main()

{long int x,y;


printf(输入一个整数\ n);

scanf("%d",& x);


y = x%pow(10,3);
# include <stdio.h>
# include <math.h>
int main()
{ long int x,y;

printf("enter an integer\n");
scanf("%d",&x);

y=x%pow(10,3);



[snip]

[snip]


编译器告诉我pow有问题,但是我不知道这是什么问题?
The compiler tell me there is something wrong with the "pow",but I
don''t know what''s the wrong?



pow()返回一个浮点(在这种情况下,我猜一个双倍),x是一个

long int。这不是%运算符的有效操作数类型对。

最佳


Kai-Uwe Bux

pow() returns a floating point (in this case, I guess a double) and x is a
long int. That is not a valid pair of operand types for the % operator.
Best

Kai-Uwe Bux

questions写道:
questions wrote:

#include< stdio.h>

#include< math.h>

int main()

{long int x,y;


printf("输入一个整数\ n");

scanf("%d",& x);


y = x%pow(10,3);


printf(结果是%d,y);


返回0;}


编译器告诉我粉丝有问题,但是我不知道这是什么问题?
# include <stdio.h>
# include <math.h>
int main()
{ long int x,y;

printf("enter an integer\n");
scanf("%d",&x);

y=x%pow(10,3);

printf("the result is %d",y);

return 0;}

The compiler tell me there is something wrong with the "pow",but I
don''t know what''s the wrong?



我的编译器说:


testmod.cpp:8:警告:格式?%d?期望类型?int * ?,但是参数2

的类型是?long int *?

testmod.cpp:10:错误:类型的操作数无效?long int?并且?双倍?

到二进制?运算符%?

testmod.cpp:12:警告:格式?%d?期望类型?int?,但是参数2

的类型是?long int?


它看起来非常清楚。听听你的编译器。这是你的朋友。


祝福,

Zeppe

my compiler says:

testmod.cpp:8: warning: format ?%d? expects type ?int*?, but argument 2
has type ?long int*?
testmod.cpp:10: error: invalid operands of types ?long int? and ?double?
to binary ?operator%?
testmod.cpp:12: warning: format ?%d? expects type ?int?, but argument 2
has type ?long int?

It looks pretty much clear. Listen to your compiler. It''s your friend.

Best wishes,

Zeppe


问题写道:
questions wrote:

y = x%pow(10,3);
y=x%pow(10,3);



1000有什么问题?

What''s wrong with 1000?


这篇关于怎么了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆