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 coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.