getting accurate numbers



QUESTION: so I have the code except the results are not accurate, I tried double and float
Here is the code
1
2
3
4
5
  cout << '\n';
        cout << " The guessed rate would be: " << new_price << " cents/KWHr\n";
        cout << "The desired rate should be: " << end_price << " cents/KWHr\n";







Last edited on
Check out all the toys in iomanip.
1
2
3
4
5
6
7
8
9
        cout << '\n';
        cout.precision(2);
        cout << std::fixed;
        cout << "The guessed rate would be : "
             << new_price
             << " cents/KWHr\n";
        cout << "The desired rate should be: "
             << end_price
             << " cents/KWHr\n";

thanks salem! nice toys!
Topic archived. No new replies allowed.