- #1
frogdogbb
- 45
- 0
I know I am not a moron but this C++ is killing me, I have to write a program using functions to convert temp between c, f, k I am hung up
// Mod4project2tempconvert.cpp : Defines the entry point for the console application.
#include <iostream>
using namespace std;
double ftemp (double F, double C, double K, double temp, double scale)
{
while (scale != 0)
{
if (scale==C);
F=temp*9/5+32;
K=temp+273.15;
if (scale==F);
C=(temp-32)*5/9;
K=(temp-32)*5/9+273.15;
if (scale==K);
F=(temp-273.15)*9/5+32;
C=temp-273.15;
}
}
int main()
{
double F, C, K, temp, scale;
cout<<"Enter the scale you want to convert from C, F, or K- 0 to quit: ";
cin >> scale;
cout<<"\nEnter temperature";
cin >> temp;
cout<<"\nCongratulations you entered "
<<scale<<"The following results are your converted temperatures "
<<ftemp(C, F, K)<<endl;
return 0;
}
Any help?
Thanks
// Mod4project2tempconvert.cpp : Defines the entry point for the console application.
#include <iostream>
using namespace std;
double ftemp (double F, double C, double K, double temp, double scale)
{
while (scale != 0)
{
if (scale==C);
F=temp*9/5+32;
K=temp+273.15;
if (scale==F);
C=(temp-32)*5/9;
K=(temp-32)*5/9+273.15;
if (scale==K);
F=(temp-273.15)*9/5+32;
C=temp-273.15;
}
}
int main()
{
double F, C, K, temp, scale;
cout<<"Enter the scale you want to convert from C, F, or K- 0 to quit: ";
cin >> scale;
cout<<"\nEnter temperature";
cin >> temp;
cout<<"\nCongratulations you entered "
<<scale<<"The following results are your converted temperatures "
<<ftemp(C, F, K)<<endl;
return 0;
}
Any help?
Thanks