Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ifstream fin; fin.open (\"temps.txt\"); if (!fin.good()) throw \"I/O error\"; do

ID: 3652479 • Letter: I

Question

ifstream fin;
fin.open ("temps.txt");
if (!fin.good()) throw "I/O error";

double f; // degrees F
double c; // degrees C

while (true)
{
fin >> c;
fin.ignore(1000, 10);

if ( c == -999 ) break;
f = 9.0 / 5 * c + 32;
cout << c;
cout << " Celcius equals ";

cout.setf(ios::fixed|ios::showpoint);
cout << setprecision(1);
cout << f;
cout << " Fahrenheit" << endl;

}
fin.close();
}


How can I format the variable "c" as it is instead of rounding it to decimals? Say I have 10.00000000011, I wish to have it as the exact value as it is in the output, how do I accomplish this?

Explanation / Answer

//in that case, just add these lines right before cout