The way I have the program written now when you hit run it will just calculate conversions up to the max_fahrenheit = 100. I want to be able to ask the person using the program to enter the number of conversions they want to see. I have put a text block around the code that asks for input below. I need to figure out how to take that input and give the user back the number of conversions they want. Any help would be greatly appreciated.
Code:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
double celsius;
int fahrenheit;
const int far_value = 20;
const int far_step = 4;
int max_fahrenheit=100;
int conversions;
cout<<"This program is designed to convert values from fahrenheit to celsius\n"<<endl;
/*cout<<"Please enter the number of conversions\n"<<endl;
cin>>conversions;
*/
fahrenheit = far_value;
cout<< setiosflags(ios::showpoint)
<< setprecision(2);
cout<< "\n Degrees Degrees\n"
<< "Fahrenheit Celsius\n\n";
while (fahrenheit <= max_fahrenheit)
{
celsius = (fahrenheit - 32.0) / (9.0/5.0);
cout<< setw(5) << fahrenheit << fixed
<< setw(15)<< celsius << endl;
fahrenheit = (fahrenheit + far_step);
}
system("pause");
return 0;
}


