• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

simple c++ question

Page 3 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.
Originally posted by: EyeMWing
Originally posted by: dighn
Originally posted by: EyeMWing
Originally posted by: Goosemaster
Originally posted by: EyeMWing
Wowserpants, I've never seen someone F up comments.

Dude...all i have ever used is unix shell scripting...and html


<--was about to comment sing "#"'s

I'm having to sit through CS 101, too. And I can tell you this much: The first piece of "code" we went over was commenting 😛

Also, your style is annoying. INDENT! FOR THE LOVE OF GOD, INDENT.

And your comments should either be positioned next to (in most cases) or above (in the case of "sections") the relevant bits. Not below them. 😕

Programming courses need to focus more on code style, readability and modularity, since 99.9999% of a program's development cycle is spent being updated by someone other than the original dev team.

one step at a time 🙂

These are things you have to beat into a programmer's head when they're still baby programmers. If it looks like crap the first time they do it, it will largely stay that way.


True, so true
 
I'm roughly 90% certain you need "using namespace std;" below the include.

Other than that, you should be cool (except for the style issues that make me want to murder you with a shovel)
 
you need "using..." when you are using the new header style ie. without .h (eg <iostream> instead of <iostream.h> )

the old style still works for compatibility reasons but you should use the new header convention when you can
 
Originally posted by: Goosemaster
http://wisetyro.com/BuildLog.htm


I am losing any respect I could have possibly have had here😱

k are you using visual c++ to compile that? visual c++ allows the use of precompiled headers and it seems your project is using that option but you've removed the stdafx.h (the precompiled headers) reference

try adding it back eg #include "stdafx.h"
 
Originally posted by: dighn
Originally posted by: Goosemaster
http://wisetyro.com/BuildLog.htm


I am losing any respect I could have possibly have had here😱

k are you using visual c++ to compile that? visual c++ allows the use of precompiled headers and it seems your project is using that option but you've removed the stdafx.h (the precompiled headers) reference

try adding it back eg #include "stdafx.h"

?😱

edit: updated pic to include changes
 
Originally posted by: Goosemaster
Originally posted by: dighn
Originally posted by: Goosemaster
http://wisetyro.com/BuildLog.htm


I am losing any respect I could have possibly have had here😱

k are you using visual c++ to compile that? visual c++ allows the use of precompiled headers and it seems your project is using that option but you've removed the stdafx.h (the precompiled headers) reference

try adding it back eg #include "stdafx.h"

?😱

sorry.. of course you are using vc++ hence that log...

basically, add
#include "stdafx.h" to the top of the file and try again
 
Originally posted by: ngvepforever2
try using this online compiler

ONLINE COMPILER

Your Comeau C/C++ test results are as follows:

Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"como/include/stdafx.h", line 1: catastrophic error: #error directive:
stdafx.h is not a Standard C++ header, please read the instructions
on what this interactive compiler will support
#error stdafx.h is not a Standard C++ header, please read the instructions on what this interactive compiler will support
^

1 catastrophic error detected in the compilation of "ComeauTest.c".
Compilation terminated.

In strict mode, with -tused, Compile failed
 
Originally posted by: Goosemaster
fatal error C1083: Cannot open precompiled header file: 'Debug\Celsius To Fahrenheit.pch': No such file or directory

well... obviously the vc++ compiler is looking for precompiled headers. either the IDE never created it for you or you deleted it or something else is wrong... can't really tell.

basically, your code should be working. it's just some quirk of that visual c++ compiler. it can be solved but as you can see, it's kind of difficult over the forums 😉

is it possible for you to send me the whole project as a zip file?
 
Originally posted by: Goosemaster
Originally posted by: ngvepforever2
try using this online compiler

ONLINE COMPILER

Your Comeau C/C++ test results are as follows:

Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"como/include/stdafx.h", line 1: catastrophic error: #error directive:
stdafx.h is not a Standard C++ header, please read the instructions
on what this interactive compiler will support
#error stdafx.h is not a Standard C++ header, please read the instructions on what this interactive compiler will support
^

1 catastrophic error detected in the compilation of "ComeauTest.c".
Compilation terminated.

In strict mode, with -tused, Compile failed


try putting this is

// C++ Program to Convert from celius to Fahrenheit and from fahrenheit to celsius


#include <iostream>
//Preprocessor Directives



int main(void)

{using namespace std;

double fahrenheit;
double celsius;
// Declaring Variables
cout <<"Hello. Welcome to the Temperature conversion program" <<endl;
cout <<"Please enter a Celsius value and press ENTER:" <<endl;
cin >> celsius;
fahrenheit= ((9.0/5)*celsius) + 32;
cout <<"You entered = " <<fahrenheit <<"celsius" <<endl;

return 0;
//finish running the program and return control to the operating system
}

 
Originally posted by: Goosemaster
WOOHOO I FIXED IT..it compiled online

stupid std's "P

cool...now stop using Xpress and use plain borland to compile. go to the command ...set your path and you are set. It's funny it's almost a year since I have touched C...but it's all coming back now.

Regards

ng
 
Originally posted by: ngvepforever2
Originally posted by: Goosemaster
WOOHOO I FIXED IT..it compiled online

stupid std's "P

cool...now stop using Xpress and use plain borland to compile. go to the command ...set your path and you are set. It's funny it's almost a year since I have touched C...but it's all coming back now.

Regards

ng

where can I get it then?

Thsi ms stuff is pissing me off..it says that it cannot find the \debud \ xxx.exe file and that I might need that std file🙁
 
Originally posted by: Goosemaster
Originally posted by: ngvepforever2
Originally posted by: Goosemaster
WOOHOO I FIXED IT..it compiled online

stupid std's "P

cool...now stop using Xpress and use plain borland to compile. go to the command ...set your path and you are set. It's funny it's almost a year since I have touched C...but it's all coming back now.

Regards

ng

where can I get it then?

Thsi ms stuff is pissing me off..it says that it cannot find the \debud \ xxx.exe file and that I might need that std file🙁


The one that says compiler

EDIT: sorry david...but WTH is NiK?
 
Originally posted by: ngvepforever2
Originally posted by: Goosemaster
Originally posted by: ngvepforever2
Originally posted by: Goosemaster
WOOHOO I FIXED IT..it compiled online

stupid std's "P

cool...now stop using Xpress and use plain borland to compile. go to the command ...set your path and you are set. It's funny it's almost a year since I have touched C...but it's all coming back now.

Regards

ng

where can I get it then?

Thsi ms stuff is pissing me off..it says that it cannot find the \debud \ xxx.exe file and that I might need that std file🙁


The one that says compiler

ah..I tought it was personal edition that I needed...😱

So what should I use as the IDE in windows?

Should I stick to Xpress or use something else?
 
Originally posted by: ngvepforever2
Originally posted by: Goosemaster
Originally posted by: ngvepforever2
Originally posted by: Goosemaster
WOOHOO I FIXED IT..it compiled online

stupid std's "P

cool...now stop using Xpress and use plain borland to compile. go to the command ...set your path and you are set. It's funny it's almost a year since I have touched C...but it's all coming back now.

Regards

ng

where can I get it then?

Thsi ms stuff is pissing me off..it says that it cannot find the \debud \ xxx.exe file and that I might need that std file🙁


The one that says compiler

EDIT: sorry david...but WTH is NiK?

quiet, lest you awaken the beast:laugh:
 
Back
Top