Hi everyone,
i was asked to convert celsius degree temp in a range of 0-100
in increment of 5 degree celsius to the equivelant fahrenhite temp and diplay them as 2 colmns without prompting the user i'm getting 100 and 100 as aoutput?. I hope you help with that . thank you
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
int celsius =0;
double fahranhite=0.0,convCels; // I have to declare fahrenhite as
// double
for(int i =0; i < 100; i++)
{
celsius+=5;
fahranhite++;
First, you don't need to loop i. Just quit when celsius is greater than 100.
Second, you set convCels, but never used it. You need to set fahranhite equal to convCels, or better yet, just drive fahranhite directly.
If you want two columns, put the cout in the loop, otherwise you'll only get the final answer.
Finally, I don't know why you were incrementing fahranhite. It was simply counting up from 0 to 100 and then you sent it out at the end. I think you wanted to set it like you set convCels.