Completely New NEED help

Pages: 12
Hello, I would like to learn C++ but have No idea where to start. What is a good tutorial to watch? What should i download? All i have right now is Microsoft Visual C++ Express 2010. Also, When i take the code
1
2
3
4
5
6
7
8
9
10
// my first program in C++

#include <iostream>
using namespace std;

int main ()
{
  cout << "Hello World!";
  return 0;
}

In notepad, save as .cpp, and open it, it just brings me to the MS visual thing,
again, i have no idea wjat i'm doing, all help would be appreciated
You need to create an executable before you can run your code, which involves compiling your code and linking it. You already have Visual C++ which handles all of this for you. To make a new project in Visual Studio go to File->New->Project and the New Project wizard should open. Then go to the General Tab and select "Empty Project." Give your project a name and choose wherever you want it to be saved. Once the project is open look in the solution explorer (if you can't view it go to View->Solution Explorer at the top of the screen). You should then see four folders, External Dependencies, Resource Files, Header Files and Source Files. Right click on the Source Files folder and select Add->New Item. Then click the Code tab and select "C++ Files (.cpp)." Name the file either main or the title of your project. Then type in all of your code. Once all the code is typed in press Ctrl-F5 to run the program! You can also press just F5 to run the program, but if you press Ctrl-F5 Visual Studio will add a "Press any key to continue. . ." message at the end of the program to keep the window from closing immediately.

Hope this helps! Don't worry about all the other folders, file types and options. When you're starting out in C++ what I've just explained should be more than enough to get by. Once you get to adding classes, making windows forms, using the MFC or making C++/CLI programs the rest of these options within the IDE will make sense and you'll see how powerful Visual Studio can be :-)
Last edited on
Ok that helped, thanks. But i did everything you said, and then when i hit F5, i got something that said this project is out of date would you like to build it? i hit yes, then hit F5 and all i got was a cmd pop-up that is too quick for me to read, is that what is supposed to happen?
Last edited on
closed account (D80DSL3A)
ascii explained how to avoid that problem in his post above.
In Visual C++.

1. Create new project
2. Select C++, Win32 console project
3. In the wizard, check "Empty Project"
4. make a .cpp file in the sollution explorer (docked at left)
5. open it and put your code in it.
6. Hit F5.

I would use a system"pause"); before you return 0, as it will stop the console from exiting. Be warned, it's not advisable to use system functions when you get past writing them for educational purposes and debuging.
Last edited on
@funcode, where did he explain? I don't see it.
@GiseleAune Could you explain what a system pause is and how to use it? This is my first day learning this, sorry
@funcode, where did he explain? I don't see it.
Well, it's there, so read more carefully.
GisleAune, isn't that kind of exactly what I just said but less detailed... lol.
@ascii, lol it is.
@helios *RAGES* please show me where, im a newb
All you have to do is read the whole post!
Last edited on
I have read the whole thing can you point it out? Sorry. Is it the ctrl+F5 part? i tried that it does the same thing as f5
Is it the ctrl+F5 part? i tried that it does the same thing as f5
Works for me.
rofl

I don't know how ascii can be more explicit - GisleAune even repeated the answer 8'P

<sarcasm on>maybe someone needs to post a youtube video for Taco</sarcasm off>

edit: ascii, you are a machine - I mean that as a compliment! next time I need a compiler, I will use you instead ;^)
Last edited on
Ok, i've done ALL that. All that happened is the little cmd popup for half a second. What do i do when i get a popup saying the project is out of date? Do i say Yes or No to the option of building it? i've tried both to the same result. I'm sorry for taking up your time.
Last edited on
You can't open a tag with </ >

@Indecent Taco, I promise you it works. Hold down Ctrl and press F5, and be amazed!
I have, nothing happens. I thin something is wrong with my computer, because i've done everything
Ok, it worked. THe cmd popup does say Hello world. How do i get it to stay longer? (sorry im a newb)
What do you mean by stay longer? Is the window still flashing?
When i hit F5, the text will pop up in a cmd-like box. But it flashes so quickly, and only once. how do i make it stay? you said Ctrl+F5 but that is not working for me.
Honestly I have no idea. Ctrl-F5 should always work, for everyone. Perhaps you're hitting the keys wrong :o?
Pages: 12