Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
97 views
in Technique[技术] by (71.8m points)

c++ - Is there any method of converting the data in double?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You have declared your draw_hud function to take three parameters, namely proportion, player and planet.

void draw_hud(double proportion, const player_data &player, const planet_data &planet);

but when you call the function you only give two parameters

draw_hud(player, planet);

The proportion parameter is missing.

The answer is not to convert a player to a double. The answer is to call your function with the correct number of parameters. Either add a parameter to where you call the function e.g.

draw_hud(1.0, player, planet);

(obviously I just made up the number 1.0, only you know what the correct number is).

Or remove the extra parameter from your declaration

void draw_hud(const player_data &player, const planet_data &planet);

Either way the number of parameters in the declaration and in the function call must be the same.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...