C++...HELP

Joined
6/6/08
Messages
1,194
Points
58
Okay I'm at a rut...

I tried bloodshed C++ but that closes on me as soon as I try to run a program, and microsoft visual C++ just confuses the living hell out of me.

In either case, I can't get even a Hello World program to run correctly.

Is there some simple C++ compiler out there for me to just sit down and start coding again?

I had one course in C++ but it was so poorly taught and didn't teach me where I'd use this (literally all the stuff could be done 10x faster in excel) and so I forgot it all by now and am trying to relearn from the ground up.

Can someone please point me in the way of getting started for a C++ newbie? I know I need it to get into finance, but it's really my greatest barrier. All help is greatly appreciated.

Thanks a lot in advance.
 
I know you said MS Visual C++ confuses you, but it's pretty easy to get started writing simple console apps, at least. You can download the free Visual C++ Express Edition here. Then just File -> New Project -> Win32 Console Application -> Finish, type up your code, then Ctrl+F5.

It could be that your console applications are closing as soon as you run them because there isn't any sort of pause at the end of execution, so it closes the window. If you "Run without debugging"(Ctrl+F5) in Visual Studio it will insert a pause for you.
 
It could be that your console applications are closing as soon as you run them because there isn't any sort of pause at the end of execution, so it closes the window. If you "Run without debugging"(Ctrl+F5) in Visual Studio it will insert a pause for you.
:iagree:What Pravit points out here is most likely to be the case. When using Bloodshed compiler, you need a pause line at the end of the main function, preceding the return statement. Simple solution would be to add
Code:
system("PAUSE");
This one, however, is Windows-specific. Instead, I prefer to prompt for user input, for example
Code:
cin.get();
 
Funny...my C++ doesn't recognize system and so gives me errors. It also doesn't recognize cin!

c:\documents and settings\ilya kipnis\my documents\visual studio 2005\projects\hello world\hello world\hello world.cpp(10) : error C2065: 'cin' : undeclared identifier
c:\documents and settings\ilya kipnis\my documents\visual studio 2005\projects\hello world\hello world\hello world.cpp(10) : error C2228: left of '.get' must have class/struct/union
type is ''unknown-type''

Is what it throws me.
 
The first error is because you need to either put using namespace std after the include or use std:: before cin, cout
No idea what you were doing to get the second error.
Code:
#include <iostream>
int main()
{
    std::cout << "Hello, world!\n";
}
 
Well, I went and DLed Bloodshed C++, and now the system("PAUSE") works. Hopefully now I can start reteaching myself this language. Thanks for all of your help so far, guys. Sorry to have to make you put up with a newbie :(
 
Back
Top Bottom