c++

godlike_3000

New Member
error c++

can anyone help me with c++?i just got started and i am getting some error messages when i try to run the programm...
Untitled.jpg
This is the program i write in the notepad:


#include<iostream.h>

using namespace std;

void main(void)

{

double dnumber1, dnumber2, dnumber3, daverage;

cout <<"Put three numbers:" <<endl/;
cin >> dnumber1 >> dnumber2 >> dnumber3;
daverage = (dnumber1 + dnumber2 + dnumber3) / 3;

cout << "The average is:" <<daverage << endl;

}

I rename the extension and instead of *.txt i rename it to an executable file *.exe. Then i open the command prompt and i write *.exe. See the picture for the error message.
http://www.computerforum.com/attachment.php?attachmentid=2255&stc=1&d=1196395133
 

addle_brains

New Member
The code isn't necessarily bad, it should compile and run. It just sounds to me like you're not using a compiler. You need to give it the extension .cpp. Then get a compiler (there are heaps available, try Visual C++ express or google some other C++ compilers.) Then you need to compile it and it will turn it into a .exe file. I would recommend reading some tutorials at cplusplus.com.

Couple of code tips:

1. Don't use iostream.h ... just use iostream
2. Use int main() or int main(int argc, char* argv[])

Also, can I take this opportunity to request an extra programming forum for the board if there's enough support for it.
 
Last edited:

addle_brains

New Member

I hate those programming forums. They're full of pompous know-it-alls who will try to shoot you down to make themselves feel better. Every single time I post a question on there, the answers are usually similar to:

"Why the hell would you want to do that? That's so stupid. You haven't given me enough information to answer your question. Please come back when you're not a noob."

I have given up with them. For some reason computerforum.com is better. You can actually feel safe when asking an honest question that people won't judge you, they'll just try their best to answer it. So yeah, I'd like a programming board here.
 

Cromewell

Administrator
Staff member
I agree, those dedicated programming forums are irritating. There's at least a handle of regulars who are coders here (maybe more, I'm not sure), I don't think anyone is working as a programmer but for beginners with some questions we can easily handle it.
 
Top