SmileC++ Basic Coding

Posts 1–15 of 38 · Page 1 of 3
C++ Basic Coding
Requirements:
First off you will need C++ get it >HEREⓘ<.
A brain and basic computer knowledge.

What you will learn (Updated Version 1):
*Making your first C++ program
* Fundamental Commands/Instructions/Keywords
* Custom made Commands/Instructions...
* .cpp .c / .hpp .h files (source/header)
* Including headers in source files
* Using stuff from header files
* Functions
* The c++ main function

Lets get started:

When you open Visual C++ 2008 Express Edition or whatever version of C++
click "new project" then you should get this:


Now for this tutorial we want to click this:



now we want to name it "tutorial 1".
You should get this:


Now we want to click since all the settings we need are already done.

If all was done right you should something like this:



Q: what is a project?

A:neat way of storing all the files and options and settings together in one folder so that when were ready to compile are project everything is neatly stored in a neat place where we can find them and the compiler can find them and where everything will be compiled and are .exe program will be ready.

Q: what is a file that ends with .cpp?

A: any file with .cpp at the end, is that file that is gonna get compiled by the compiler. CPP stands for "C++" which obviously means the file contains C++ code.

Now time to get to the coding:
open "tutorial 1" in C++ and erase everything so we can start from scratch.
this will be are first line of code:


Code:
#include "stdafx.h"
now any code in blue is a keyword which are the main basic words which are the commands of this programming lang. what the #include is doing is "wait, dont go any further yet, please go ahead and open of this file which is in the quotes "" or triangular brackets and read everything thats there and compile all that stuff first and then continue with the rest of the .cpp file code.
now are second line of code:

Code:
#include <iostream>
now we are using brackets because quotes "" are local file which is in are project, and brackets are telling it it's in a place it should know, because its already set in the compiler settings. now red code is usually the headers, code already made by programmers.
now are third line of code:
Code:

Code:
using namespace std;
now were telling the program we are going to use a package "std" and asking permission to use the package.
now are fourth line of code:
Code:
int main()
what we are doing is creating a function and we named it main
are fifth line of code:

Code:
{
this is a opening brace function
are six line of code:


Code:
cout << "Hello World!";
"cout" is a basic word, its not a main C++ keywords, and is located in <iostream> and the triangular brackets are required when using "cout" and since we wanted to display text the way we display text is we enclose it inside quotes. then we have the semi colan, most keywords in C++ must end with a semi colon.
are seventh line of code:


Code:
cin.get();
all this really is doing is telling the program to wait til you push enter
are eight line of code:


Code:
return 0;
all this is doing is telling the compiler the code is done, stop this function and go back to whatever was happening before. Also something to keep in mind is C++ is CASE SENSITIVE. so if you type anything in this code in cap it will give you a error because it wasnt told what for say Cin.get(); in was.
are ninth line of code:


Code:
}
this is a closing brace function.
finalized product:


Code:
#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
     cout << "Hello World!";
     cin.get();

    return 0;
}
to test this and see your first C++ program click this
and congrats

hope you learned something
good day.
If you have any questions go ahead and PM me, I am more then happy to answer questions or problems etc.

I am happy that you put in the effort to create this tutorial, but there are way too many "Tutorials" For c++ that shows someone hello world, and then don't continue. At least you are kind of explaining what everything means unlike some of the others I've seen.

But this isn't enough to teach squat.

Good job though.
Quote Originally Posted by zeco View Post
I am happy that you put in the effort to create this tutorial, but there are way too many "Tutorials" For c++ that shows someone hello world, and then don't continue. At least you are kind of explaining what everything means unlike some of the others I've seen.

But this isn't enough to teach squat.

Good job though.
at least you have respect and not the lets try and see what he did wrong and close this thread called gam(e)rzpl(a)net they treated me like shit i did something wrong that doesn't effect the program, and they said this "why the fuck did you import the entire fucking namespace?"
yea i followed ur instucktions real close my code looks like ur in every way and it comes up with an error cud u plzz help me i really wanna learn c++
"why the fuck did you import the entire fucking namespace?"

lol? I always thought 'using namespace std' was for the compiler to let it know ur too lazy to type std:: all the time o__O
Nice tut man copy&paste but nice
Well this is a good introduction to VS. Well there you go guys, I'll add this as a Beginner tutorial.
Quote Originally Posted by BxR View Post
Requirements:
First off you will need C++ get it >HERE<.
A brain and basic computer knowledge.

OMG DUDE DUDE DUDE, someone finally found it, i'm totally downloading C++.
Quote Originally Posted by ilovecookies View Post
OMG DUDE DUDE DUDE, someone finally found it, i'm totally downloading C++.
OH SHIT, Tell ThatOn3Guy. I think he's looking for it too yo!
Wow great job explaining.
Great introduction for people who want to learn C++
lol im glad i help a lot better then GP, thanks for all the compliments
sorry i didn't replay, i just got back from California, i finished my computer graphics course and doing the finals online.
This si the Basic of the basic xD

who doesnt know

#include "stdafx.h"
#include <iostream>

using namespace std;

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

system("pause")
return 0;
}

i prefer system("pause") b/c it doesnt interfere on the screen as much when you have to type something
This si the Basic of the basic xD

who doesnt know

#include "stdafx.h"
#include <iostream>

using namespace std;

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

system("pause");
return 0;
}

i prefer system("pause") b/c it doesnt interfere on the screen as much when you have to type something
Nice double post, and who ever hasn't started doesn't know that.
Quote Originally Posted by crushed View Post
OH SHIT, Tell ThatOn3Guy. I think he's looking for it too yo!
OH SHIT! SOMEONE FOUND THE LOST TREASURE OF C++, hallelujah.

Grammar Nazi.

"First off you will need C++ get it >HERE<."

You don't need C++, you need a Compiler/Linker/IDE.
Posts 1–15 of 38 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us