A little more help......
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]
I''m not sure because I don''t have the book, but if you post the source code we will be able to help you.
:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]
:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
probably a console window with the words "Hello World"
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
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]
:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]
[edited by - Lektrix on February 7, 2003 4:30:04 PM]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
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]
And so, the evil religion thread stole the wonderful "What the Heck?" thread's throne. Truly a sad day for gamedev.
Ooooh, k, Mindless Thrall: May I suggest a new book?
:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]
:::: Lektrix ::::
[ Google || ACCU || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || CUJ || MSVC++ Library Fixes || BarrysWorld || [email=lektrix@barrysworld.com]E-Mail Me[/email] ]
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.
Peon
all spelling and syntax errors aside...
Why?
quote:
factor = 212 - 32;
Why?
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
That''s my interpretation, anyway :D
Peon
Peon
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!
Yo Tyler, I hear your mum''s goin out with... SQUEEK!
the future is just like the past, just later. - TANSTAAFL
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement