I have finished the conversion and step part of the code but I think I have used a number of work around which are probably not very good practice?
Code:
#include <iostream>
using namespace std;
int main()
{
double maxc, minc, maxf, minf, stepc, stepfv, stepcv;
int steps;
cout<< "RollCast's Celsius to Farenheit Converter \n";
do
{
cout<< "Please enter the max. temp. in celsius.\n";
cin>> maxc;
cout<< "Please enter the min. temp. in celsius\n";
cin>> minc;
cout<< "Please enter the number of steps for the range\n";
cin>> steps;
if (minc > maxc || steps < 0)
{
cout<< "The values you have entered are wrong please check them and re-enter\n";
}
}
while ((minc > maxc || steps < 0));
if (steps == 0)
{
maxf = 1.8 * maxc + 32;
minf = 1.8 * minc + 32;
cout<< "Max. Temp. in F ="<< maxf <<endl;
cout<< "Min. Temp. in F ="<< minf << endl;
}
else
{
int stepdiv = steps += 1;
for (int i = 0; i < steps; i++)
{
if (i == 0)
{
maxf = 1.8 * maxc +32;
cout<< "Max. Temp. in F ="<< maxf <<endl;
}
if (i != 0)
{
stepc = (maxc - minc)/ stepdiv;
stepcv = maxc - (stepc * i);
stepfv = 1.8 * stepcv + 32;
cout<< "Step in F ="<< stepfv<< endl;
}
if (i + 1 == steps)
{
minf = 1.8 * minc + 32;
cout<< "Min. Temp. in F ="<< minf <<endl;
}
}
}
cout<< "Press ENTER to continue";
cin.get();
cin.ignore();
return 0;
}