New
#1
C++ help, Homework assignment
So i was wondering if anyone could help me out on my homework assignment
So far were just starting this is week 4. I need assistance trying to convert fahrenheit to kelvin
this is what i have so far
My comments describe my error but if you cant read them for some reason. it // calculation has been seperated into parts indiviually because the result being output is incorrect#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
// originally was just fah and kelvin. extraa kelvins were added in order to attempt to gain correct output.
// output remains 273 which is incorrect
float fah, kelvin0, kelvin1, kelvin2;
//fix and setp so it can round to ones decimal places
cout << fixed;
cout << setprecision(1);
cout << "== Fahrenheit to Kelvin converter ==" << endl;
cout <<"Enter Fahrenheit:" << endl;
cin >> fah ;
// calculation has been seperated into parts indiviually because the result being output is incorrect
// the result is always 273 original formula was kelvin = (fah - 32) * (5 / 9) + 273.15
kelvin0 = (fah - 32);
kelvin1 = kelvin0 * (5/9);
kelvin2 = kelvin1 + 273.15;
cout << "Kelvin: " << kelvin2 << endl;
}
// the result is always 273 original formula was kelvin = (fah - 32) * (5 / 9) + 273.15
Also do you guys know of a great forum that deals with C++/ assisting in homework C++ related?
i think i am going to need C++ friends in order to succeed in this class.