• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

Data Conversion Warning

Hi, There data conversion warning from double to int when compile, is there anyway to solve this?

double a = 100.30;
int i = (int)a;

this is the syntax.
0
iphone
Asked:
iphone
  • 2
1 Solution
 
jkrCommented:
Just ignore the warning if all you want is to convert a double to an integer or use

double a = 100.30;
int i = retinterpret_cast<int>(a);

0
 
jkrCommented:
Sorry, the last part should have been

double a = 100.30;
int i = static_cast<int>(a);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now