I am trying to generate a table of conversions from Celsius to Rankin and allows the user to enter the starting temperature and increment between lines. Print 25 lines in the table using a for loop.
This is what I have but I am getting a (fatal error LNK1169).
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double Celsius, x;
cout << "Enter the starting temperature for Celsius ";
cin >> Celsius;
cout << " Celsius Rankin" << endl;
Thank you kind sir. Would you happen to know how to get this program to execute 25 times, because, the way it is now it executes 5 times and that is it.
The reason it only goes through the loop 5 times is because of this line at the end of your for loop: Celsius+=5;
Remove that, and the loop will repeat 25 times.
@Aaron
Your formula for getting Rankine was wrong, and the for loop, incorrect. No matter what was inputted as Celsius, the for loop sets it to zero. Here is your program, working correctly.
@Aaron
Why do you think the program disregards the users input.? the tr variable (Total Rankine) gets equal to the Celsius input. Tr is multiplied by 1.8, and then 491.67 is added to it. Now tr is equal to Celsius Rankine. Cout prints it to screen, The Celsius input is increased by 5 degrees, as you intended, and the whole process is done again. The x in the loop is just to increase Celsius, 25 times, as you specified in the first post.