//============================================================================
// Name : f2c.cpp
// Author : Zachary S
// Version :X^e2
// Copyright : my granny will find you
// Description : Using a loop that counts to 20, it takes in the loop number, converts it as a temp in F and prints it out as a C
//============================================================================
#include <iostream>
using namespace std;
double toCelcius(int Temp)
{
return (5.0/9.0)*((double)Temp - 32.0);
}
int main()
{
cout << "fahrenheit \t to \t celsius\n";
for (int i = 0;i <= 20;i++)
{
cout << i << "\t\t" << (int)toCelcius(i) << endl;
}
}
// Name : f2c.cpp
// Author : Zachary S
// Version :X^e2
// Copyright : my granny will find you
// Description : Using a loop that counts to 20, it takes in the loop number, converts it as a temp in F and prints it out as a C
//============================================================================
#include <iostream>
using namespace std;
double toCelcius(int Temp)
{
return (5.0/9.0)*((double)Temp - 32.0);
}
int main()
{
cout << "fahrenheit \t to \t celsius\n";
for (int i = 0;i <= 20;i++)
{
cout << i << "\t\t" << (int)toCelcius(i) << endl;
}
}
No comments:
Post a Comment