Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Mindless Thrall

A little more help......

This topic is 5668 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello again..... i have a simple question, i have the C++ for dummies book, and im working on the fist porogram it tells you to make. (im using the Dev-C++ 4 program insted of the GNU compiler that the C++ dummmies supplies). any way, what exactly is supposed to happen when i run this program?. im sorry for bothering you people with my troubles. Source code, ok. // // Program to convert temperature from Celsius degree // units into Fahrenheit degree units: // Fahrenheit = Celsius * (212 - 32)/100 +32 // #include <stdio.h> #include <iostream.h> int main(int nNumberofArgs, char* pszArgs[]) { // enter the temperature in Celsius int celsius; cout << "Enter the temperature in Celsius:"; cin >> celsius; // calculate conversion factor for Celsius // to Fahrenheit int factor; factor = 212 - 32; // use conversiot factor to convert Celsius // into Fahrenheit values int fahrenheit; fahrenheit = factor * celsuis/100 + 32; // output the results cout << "Fahrenheit value is :"; cout << fahrenheit; return 0: } _________________________________________________________________ thats the sorce code, Right? is there something im doing wrong? Thank you for you help, kind one. may the wheel turn in your favor. P.S. im not sure if im asking the right question for the answer im looking for..... what is supposed to happen when you run the program. [edited by - Mindless Thrall on February 7, 2003 1:39:58 PM]

Share this post


Link to post
Share on other sites
Advertisement
Do you know anything about how to turn this source code into machine code, i.e. compiling? Just compile it and run it in MS-DOS. Incidently, it doesn't seem to resemble much of a typical first program, and also includes errors. Are you sure that you have posted the correct source code?

:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on February 7, 2003 4:30:04 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Lektrix
Do you know anything about how to turn this source code into machine code, i.e. compiling? Just compile it and run it in MS-DOS. Incidently, it doesn't seem to resemble much of a typical first program, and also includes errors. Are you sure that you have posted the correct source code?




I have that book and it is loaded with errors. The author "can't find no main function."



[edited by - evil sausage on February 7, 2003 4:50:12 PM]

Share this post


Link to post
Share on other sites
The code is pretty simple; I think I''ve seen it before. The comment at the top says it all. IT should open with a black screen and white text (ala DOS). It should then ask you to put in the temperature in celsius. It does a calculation or two and then outputs the value of the same temperature in degrees farenheit.

Share this post


Link to post
Share on other sites
I noticed that too, and thought "why?" as well. However, it is kind of smart in some ways. At least you have an idea of what it is. If I just wrote "int factor = 180;", I am more likely to forget what it is. Then again, what are comments for?

That''s my interpretation, anyway :D

Peon

Share this post


Link to post
Share on other sites
It''sa a program to convert celsius to Fahrenheit. Unless you run it under DOS, that program will exit straight after it says the output value. You should add getch() or system("pause") before the return 0;

Yo Tyler, I hear your mum''s goin out with... SQUEEK!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!