Stuck on homework problem.

Hi, everyone. This is my first time taking a C++ course so I was wondering if you could help me out with a problem for homework. The question in the book is:
Request the starting Celsius value, the ending Celsius value, and the increment. The condition will check for the ending Celsius value. This is a while loop problem and it is also based on code from the previous problem. Here's the code that I need to modify:

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int count = 1, num;
double cels, fahr, incr;

cout << "Enter the starting temperature in degrees Celsius: ";
cin >> cels;
cout << "\nEnter the number of conversions to be made: ";
cin >> num;
cout << "\nNow enter the increment between conversions ";
cout << "in degrees Celsius: ";
cin >> incr;
cout << "\n\n\n";
cout << "Celsius Fahrenheit\n";
cout << "----------------------------------\n";

while (count <= num)
{
fahr = (9.0/5.0) * cels + 32.0;
cout << setiosflags(ios::showpoint) << setw(7)
<< setprecision(2) << setiosflags(ios::fixed) << cels
<< setiosflags (ios::showpoint) << setw(15)
<< setprecision(2) << setiosflags(ios::fixed) << fahr << '\n';
cels = cels + incr;
count++;
}
return 0;
}

//What this program did was take the starting Celsius value, the number of conversions to be made, then the increment. It's similar to the problem I'm working on now with the exception of number of conversions to be made is replaced with the ending Celsius value. I know it's not good to just find out the answer but I just don't know how to approach this question. I've even tried writing it out to no avail. If anyone can jumpstart my thinking, it would be much appreciated. My professor also said there's little that I need to change from the original code to the problem I have now in order for it to work. Thanks for the help. :)
Hint:
Request the starting Celsius value, the ending Celsius value, and the increment. The condition will check for the ending Celsius value. This is a while loop problem and it is also based on code from the previous problem.
Last edited on
closed account (z05DSL3A)
GetStartingValue
GetEndingValue
GetIncrement

CurrentValue = StartingValue

While CurrentValue is less than EndingValue
{
      Display CurrentValue
      CurrentValue = CurrentValue + Increment
}
Ok, so this is ALL I have:

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
int count = 1;
double begCel, endCel, incr, fahr;

cout << "Enter a beginning temparature in degrees Celsius: ";
cin >> begCel;
cout << "\nEnter an ending temparature in degrees Celsius: ";
cin >> endCel;
cout << "\nEnter the increment between values: ";
cin >> incr;

return 0;
}

// Not impressive. :[
Really has to do with my logic. My logic isn't good. LOL. Thanks for the help thus far.
Topic archived. No new replies allowed.