I run this code but the output was different from what I expected. The output:
c = 1324
v = 1324.99
I expected that the output should be 1324.987 for v
. Why is the data in v
different from output?
I'm using code lite on Windows 8 32.
#include <iostream>
using namespace std;
int main()
{
double v = 1324.987;
int n;
n = int (v);
cout << "c = " << n << endl;
cout << "v = " << v << endl;
return 0;
}