Need help with Celsius to fahrenheit program

Celsius to fahrenheit help - not sure what i'm missing!

Page 1 of 1

3 Replies - 1487 Views - Last Post: 29 January 2009 - 07:01 PM Rate Topic: -----

#1 southerngenes  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 09

Need help with Celsius to fahrenheit program

Post icon  Posted 29 January 2009 - 06:36 PM

I'm not sure what I am missing here. I need it to display Celsius 0-20 and list the Fahrenheit equivalents.

Here's what I have so far:

#include "stdafx.h"
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
double c, f;

cout << fixed << showpoint << setprecision(1);

cout << "Celsius Fahrenheit\n";
cout << "--------------_------\n";

for (c=0; c >= 20; c++)
{
f = 1.8 * c + 32;

cout << c << "\t" << f << endl;
}
return 0;
}

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with Celsius to fahrenheit program

#2 Gloin  Icon User is offline

  • Expert Schmexpert...
  • member icon

Reputation: 235
  • View blog
  • Posts: 4,489
  • Joined: 04-August 08

Re: Need help with Celsius to fahrenheit program

Posted 29 January 2009 - 06:45 PM

:code:

for (c=0; c >= 20; c++)
You turned the inequality sign in the wrong direction..
Was This Post Helpful? 0
  • +
  • -

#3 southerngenes  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 09

Re: Need help with Celsius to fahrenheit program

Posted 29 January 2009 - 06:54 PM

Oops! Glad its now working! Thanks!
Was This Post Helpful? 0
  • +
  • -

#4 Gloin  Icon User is offline

  • Expert Schmexpert...
  • member icon

Reputation: 235
  • View blog
  • Posts: 4,489
  • Joined: 04-August 08

Re: Need help with Celsius to fahrenheit program

Posted 29 January 2009 - 07:01 PM

You're welcome!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1