1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
cout << "static_cast<int>((12 / 10.0 - 12 / 10) * 10) = " << static_cast<int>((12 / 10.0 - 12 / 10) * 10) << endl;
cout << "(12 / 10.0 - 12 / 10) * 10 = " << (12 / 10.0 - 12 / 10) * 10 << "\n\nWhy?\n\n";
return 0;
}
|
Output:
static_cast<int>((12 / 10.0 - 12 / 10) * 10) = 1
(12 / 10.0 - 12 / 10) * 10 = 2
Why?
Press any key to continue . . .
Last edited on
Yes, it has helped alot! Thank you!!! :)