int main(int argc, char *argv[])
{ //Ask user to input information
double int_temp, end_temp, step_temp, farenheit, celsius, kelvin;
int prcse_unit;
char ans;
cout<<"This program makes a temperature conversion table from Farenheit"<<endl<<endl;
do
{
bool repeat;
do
{
cout<<"What is the intial temperature in Farenheit? ";
cin>>int_temp;
if(repeat = int_temp <= 0)
cout<<"Cannot compute with a zero or negative initial temperature. Please re-enter"<<endl;
}while(repeat);
do
{
cout<<"What is the ending temperature in Farhenheit? ";
cin>>end_temp;
if(repeat = end_temp <= int_temp)
cout<<"Cannot compute with a temperature greater than the initial temperature. Please re-enter"<<endl;
}while(repeat);
do
{
cout<<"What is the step size between temperatures? ";
cin>>step_temp;
if(repeat = step_temp <= 0)
cout<<"Cannot compute with a zero or negative step size in temperature. Please re-enter"<<endl;
}while(repeat);
do
{
cout<<"How many units of precision do you want?";
cin>>prcse_unit;
if(repeat=prcse_unit<=0)
cout<<"Cannot have a negative precision value. Please re-enter"<<endl;
}while(repeat);
cout<<"-------------------------------------------------------------------------------"<<endl;
cout<<"Would you like to do this again?";
cin>>ans;
}while(ans == 'Y' || ans == 'y');
system("PAUSE");
return EXIT_SUCCESS;
}
I see a problem with the for loop: for(farenheit=int_temp;farenheit<=end_temp;farenheit=int_temp+step_temp)
I think you want to increment farenheit by step_temp each iteration here. This may work better: for(farenheit=int_temp;farenheit<=end_temp;farenheit+=step_temp)