1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
using namespace std;
double calcfahrenheit (double start, double end, double between);
double calccelsius(double start, double end, double between);
double calcf(double celsius);
int main()
{
int choice;
double tstart, tend, tinterval;
double fahrenheit;
cout << "Which Temperature Scale Converstion Would You Like To Perform?\n";
cout << "1. Convert F to C\n";
cout << "2. Convert C to F\n";
cout << endl;
cout << "What is your choice? ";
cin >> choice;
cout << endl;
switch(choice)
{
case 1:
cout << "Starting Temperature: ";
cin >> tstart;
cout << "Ending Temperature: ";
cin >> tend;
cout << "Temperture Increase: ";
cin >> tinterval;
cout << "Fahrenheit" << setw(12) << "Celsius\n";
cout << "----------" << setw(12) << "-------\n";
fahrenheit = calcfahrenheit(tstart,tend, tinterval);
cout << tstart << setw(10) << fahrenheit << endl;
break;
case 2:
cout << "Starting Temperature: ";
cin >> tstart;
cout << "Ending Temperature: ";
cin >> tend;
cout << "Temperture Increase: ";
cin >> tinterval;
cout << "Celsius" << setw(12) << "Fahrenheit\n";
cout << "-------" << setw(12) << "----------\n";
calccelsius(tstart, tend, tinterval);
break;
default:
cout << "You entered an incorrect code\n";
break;
}
system("pause");
return 0;
}
double calcfahrenheit(double start, double end, double between)
{
double hope;
for(start; start <= end; start += between)
{
calcf(faith)
hope = calcf(faith);
cout << start << setw(12) << hope << endl;
}
return start;
}
double calccelsius(double start, double end, double between)
{
for(start; start <= end; start += between)
{
cout << start << setw(12) << end << endl;
}
return start;
}
double calcf(double faith)
{
double constant = 32;
double multi1 = 9.0;
double multi2 = 5.0;
double quotiant;
double sum;
double please;
please = calcfahrenheit(tstart, tend, tbetween);
sum = please - constant;
quotiant = multi1/multi2;
faith = sum*quotiant;
}
|