You are viewing our Forum Archives. To view or take place in current topics click here.
C++ Computer Programming [Tutorial #1] Getting Started
Posted:

C++ Computer Programming [Tutorial #1] Getting StartedPosted:

HTTK
  • 2000 Thanks
Status: Offline
Joined: Jul 25, 20149Year Member
Posts: 2,496
Reputation Power: 313
Status: Offline
Joined: Jul 25, 20149Year Member
Posts: 2,496
Reputation Power: 313

Hello everyone and welcome to my tutorials on C++ programming!


Lesson #1 Getting Started

I will be using a program called Visual Studios as my compiler for these tutorials.

You may download the free version of it from Microsoft.

Once you have the program in stalled you will need to open the program and go to file >> new >> Projects.
You should get to this screen:
[ Register or Signin to view external links. ]
From here simply name your project what ever you desire.
Make sure "Empty Project" is highlighted then press the OK button.

Then at the top select Project >> Add New item.
This dialog screen will appear:
[ Register or Signin to view external links. ]
Simply make sure CPP file(.cpp) is selected and name it Main and hit ADD.

Now we can start actually programming!

You will need to add a your library and namespace.
Add the following:

#include <iostream>
using namespace std;


Now you will need to add your main function:
#include <iostream>
using namespace std;

int main(){

}


Now that we have told the compiler what namespace and library to read we can add some text to the program.

We will be using a cout command to tell the program what to output.
Do as I have:
#include <iostream>
using namespace std;

int main(){

cout << "Hello World";

}


The "<<" represent "output", the quotes tell the compiler where the text starts and the ends and the semicolon will end the line of code.

Now go to the top and selected the green play button:
[ Register or Signin to view external links. ]
Your program should open the immediately close.

Simply add the following to make it stay open:
#include <iostream>
using namespace std;

int main(){

cout << "Hello World\n";
system("pause");

}

"system("pause");" tells the program to pause until a key is pressed.
I have also add "\n" to end the line of code.

Now again run the program and you should see this:
[ Register or Signin to view external links. ]
You have now made your first program!
I will add a download to the source file of this once I upload it to TTG.
Part #2 will follow soon..

The following 8 users thanked HTTK for this useful post:

Skittle (04-25-2015), PMSL (04-24-2015), Resistenza (04-14-2015), Dinkleberg (03-29-2015), Dusknoir (03-29-2015), Scottish_Hacks (03-23-2015), NextGenUpdate (03-23-2015), AR15 (03-23-2015)
#2. Posted:
pawg
  • Powerhouse
Status: Offline
Joined: Jul 31, 20149Year Member
Posts: 456
Reputation Power: 61
Status: Offline
Joined: Jul 31, 20149Year Member
Posts: 456
Reputation Power: 61
Very helpful. Bookmarked for when I want to put a dent in my lack of C++ skills.
#3. Posted:
AR15
  • Comment King
Status: Offline
Joined: Oct 24, 201112Year Member
Posts: 12,652
Reputation Power: 718
Status: Offline
Joined: Oct 24, 201112Year Member
Posts: 12,652
Reputation Power: 718
This is a hell of a tutorial. I will be bookmarking this and using this tutorial to teach me some stuff!
#4. Posted:
ObscureCoder
  • Resident Elite
Status: Offline
Joined: Jun 29, 201310Year Member
Posts: 211
Reputation Power: 13
Status: Offline
Joined: Jun 29, 201310Year Member
Posts: 211
Reputation Power: 13
Please don't use system("pause"); as that's windows specific.

Use:

cin.ignore().get();

instead.
#5. Posted:
HTTK
  • TTG Addict
Status: Offline
Joined: Jul 25, 20149Year Member
Posts: 2,496
Reputation Power: 313
Status: Offline
Joined: Jul 25, 20149Year Member
Posts: 2,496
Reputation Power: 313
ObscureCoder wrote Please don't use system("pause"); as that's windows specific.

Use:

cin.ignore().get();

instead.


I will later be using getch this is just a tut
#6. Posted:
Consumed_By_Hatred
  • Resident Elite
Status: Offline
Joined: Dec 23, 201013Year Member
Posts: 292
Reputation Power: 15
Status: Offline
Joined: Dec 23, 201013Year Member
Posts: 292
Reputation Power: 15
C# is way more better than C++/C/F#
#7. Posted:
_Atrium
  • New Member
Status: Offline
Joined: Mar 24, 20159Year Member
Posts: 34
Reputation Power: 1
Status: Offline
Joined: Mar 24, 20159Year Member
Posts: 34
Reputation Power: 1
ObscureCoder wrote
Seize_The_Day wrote
ObscureCoder wrote Please don't use system("pause"); as that's windows specific.

Use:

cin.ignore().get();

instead.


I will later be using getch this is just a tut


Well, I hope you know what you're talking about because the fact that you left out return 0; on your main method makes you look stupid.


Perhaps he made a mistake. Every programmer makes mistakes.. relax.

Consumed_By_Hatred wrote C# is way more better than C++/C/F#


Java is superior. >
#8. Posted:
Consumed_By_Hatred
  • Resident Elite
Status: Offline
Joined: Dec 23, 201013Year Member
Posts: 292
Reputation Power: 15
Status: Offline
Joined: Dec 23, 201013Year Member
Posts: 292
Reputation Power: 15
All you people thinking C++ is some magical godly language lmao.

Leanr ASM-32B if you want to look like a real badass programmer.
#9. Posted:
Bashful
  • TTG Senior
Status: Offline
Joined: Aug 02, 201211Year Member
Posts: 1,915
Reputation Power: 77
Status: Offline
Joined: Aug 02, 201211Year Member
Posts: 1,915
Reputation Power: 77
ObscureCoder wrote
ProJimmyRustler wrote
ObscureCoder wrote
You're a noob at programming. Come back and challenge me when you've learned how to write a Hello World program, you imbecile.

#include <iostream>
// Complex Hello World for an ignorant user

int main() {
    int n = 0;
    again:
    for (int i = n == 0 ? 'H' : n == 1 ? 'E' : (n == 2 || n == 3 ) ? 'L' : n == 4 ? 'O' : 0; i ; ) {
        std::cout << (char)i;
        ++n;
        if (i) {
            goto again;
        }
    }
    return 0;
}


You are the Imbecile.
You always make yourself look like a fool on a daily basis in this section..
You are ignorant to other users intelligence, and all you do is spam this section with nothing but ignorant responses.


Nice a 'complex' hello program that you stole from somewhere. You come off as an idiot since you post on threads that you have no knowledge of and try to suggest idiotic things. Keep at what you're good at, which is probably nothing apart from being a retarded game dev.

Interestingly enough, you can actually use search engines to see, that it wasn't copied from elsewhere.

Realistically, if he 'stole' it from elsewhere, it would have been indexed so he could find it.

Interestingly enough, a quick google search of your username results in a lot of results.

Including some accounts attached to programming resources.

[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]


Now, whether or not this is all you, which it seems this way, remains to be seen for sure.

However, these all have something in common. A ton of complaining and absolutely nothing constructive. However, nothing to show for it.

No finished applications. Nor do you show extensive knowledge, just assumptions.
#10. Posted:
HTTK
  • TTG Addict
Status: Offline
Joined: Jul 25, 20149Year Member
Posts: 2,496
Reputation Power: 313
Status: Offline
Joined: Jul 25, 20149Year Member
Posts: 2,496
Reputation Power: 313
Bashful wrote
ObscureCoder wrote
ProJimmyRustler wrote
ObscureCoder wrote
You're a noob at programming. Come back and challenge me when you've learned how to write a Hello World program, you imbecile.

#include <iostream>
// Complex Hello World for an ignorant user

int main() {
    int n = 0;
    again:
    for (int i = n == 0 ? 'H' : n == 1 ? 'E' : (n == 2 || n == 3 ) ? 'L' : n == 4 ? 'O' : 0; i ; ) {
        std::cout << (char)i;
        ++n;
        if (i) {
            goto again;
        }
    }
    return 0;
}


You are the Imbecile.
You always make yourself look like a fool on a daily basis in this section..
You are ignorant to other users intelligence, and all you do is spam this section with nothing but ignorant responses.


Nice a 'complex' hello program that you stole from somewhere. You come off as an idiot since you post on threads that you have no knowledge of and try to suggest idiotic things. Keep at what you're good at, which is probably nothing apart from being a retarded game dev.

Interestingly enough, you can actually use search engines to see, that it wasn't copied from elsewhere.

Realistically, if he 'stole' it from elsewhere, it would have been indexed so he could find it.

Interestingly enough, a quick google search of your username results in a lot of results.

Including some accounts attached to programming resources.

[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]
[ Register or Signin to view external links. ]


Now, whether or not this is all you, which it seems this way, remains to be seen for sure.

However, these all have something in common. A ton of complaining and absolutely nothing constructive. However, nothing to show for it.

No finished applications. Nor do you show extensive knowledge, just assumptions.

I in no way copied this tutorial.
The Hello World program is used for starters for just about every language I've learned.
Ill make video tutorials next time if you guys think that.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.