Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs

C++ FULL Begginners Course!


C++ FULL Beginners Course.

Hello, I am

and this is my C++ FULL Beginners Course.

I know

already did one but I wanted to do a more in-depth anti-cycle-squeezing one.


This course is accelerated. Meaning it is meant for C#, C, Python, Java, etc. devs and will not teach you what a variable is for example. It will teach you how to make one though.

So let us begin.

Table of contents.

  • Why C++?
  • Setup
  • Quick comment overview
  • 1: Overview of a basic C++ file
  • 2: Hello, World!
  • Basic data types
  • 3: Variables
  • 4: Getting user input.
  • 5: Functions in C++
  • 6: IF Statement
  • 7: WHILE Loop
  • 8: FOR Loop
  • OOP Terminology
  • 9: In-depth OOP
  • 10: Structs
  • 11: Pointers
  • 12: .h files
  • Falts of C++
  • Where to go from here.
  • Conclusion
  • Bibliography

Why C++?

Pretend C is like a muscular guy who also happens to not be terribly bright.

C++ is like his nerdy but still muscular brother.

Still very strong and fast but not a pain to work with and more controlable.

C++ was invented by Bjarne Stroustrup in 1979 at Bell Labs as an extension to the C programming language.

He wanted an efficient, fast, and flexible language that was similar to C that also provided high-level features to organize your program.

Many languages are based off of C++ so it's a nice language to learn.


For your setup I would reccomend having the repl for this course open and checking out the C++ files there and trying to run them. For this I made it so you can run it and a bash script will execute that will prompt you which file you want to execute and run that file.

Anyway, use for now.

Quick comment overview.

This is just so that you understand when in the course I am using a comment.

A 1-line comment is used by putting a // before the comment.

// This is a one line comment.

A multi-line comment can be made by putting a /* at the start and a */ at the end a end of the comment.

/* This is a multi-line comment. Cool huh? */

Overview of a basic C++ file.

This section is going to use the 1.cpp file in the course repl.

This is the most basic of C++ files:

int main() { return 0; }

And all it does is end the program with an exit code of 0.

To see this exit code in go over to your side terminal and (after your code is done running) type echo $? to see the exit code of the last run program.

Let's break down the code.

int main() { }

Above is the main function. Your program needs one to run. It is called in the executable that your compiler will generate.

Functions in c++ have this syntax:

<return type> <name>(<args>) { <code> }

You can also put the first bracket next to the last paren like shown in the main function example.

The return type is what the data type is that the function returns.

The name is always alphanumeric but the first character can only be alphabetical it also cannot be a reserved keyword like int.

The args don't matter for this section.

And the code is where your code inside the function goes.

The return is seen in many langauges. We are returning an int like said in the return-type.

We return a 0.

And each line of code in c++ must end with either a semicolon or bracket. In the case of regular code it must end in a semicolon.

1: Hello, World!

This section is going to use the 2.cpp file in the course repl.

To print text to the screen we must use a library called iostream.

To include libraries from the standard c++ library set in our code we can do:

#include <libname>

In this case we do:

#include <iostream>

This is known as a preprocessor and we will use more of these later.

Then we define our main function:

#include <iostream> int main() { return 0; }

Then in that function we can type our line of code to print:

#include <iostream> int main() { std::cout << "Hello, World!\n"; return 0; }

Let's break the print down.

std is a container that happens to hold cout. std is known as a namespace.

We then put :: to tell C++ that we are refering to something in that namespace.

Then we put cout to tell c++ we want to use cout.

Then we put << because that is couts syntax.

We seperate our different things to print like this.

Then we put our hello world with a newline.

And lastly, our semicolon.

We run and get this output:

Hello, World!

Data types

C++ is statically typed meaning that once you declare a variable you cannot change its type.

C++ has way too many data types for us to talk about right now.

We will discuss a few and their different properties.


Chars have 's around them and they are a single unicode character.


Strings need to be included via #include <string> and they have "s around them they store multiple char types.


Ints are integers.


A double type variable is a 64-bit floating data type.


This section is going to use the 3.cpp file in the course repl.

To declare a variable we use this syntax:

<type> <name> = <value>;

The type is pretty straightforward.

Here are the identifiers for the types we discussed last section.

  • String - std::string
  • Int - int
  • Char - char
  • Double - double

The naming protocol is the same as for the functions.

The value is also easy.

Check out 3.cpp for a few examples.

Declaring a variable without an immidiate value.

We can use the syntax:

<type> <name>;

You cannot use this variable yet though.

Getting user input.

Short section but still important.

To get user input we type this:

std::cin >> <var>;

We have the same general idea as cout. We have our std:: and our name (in this case cin) then instead of <<s we put >>s and then we put the name of the variable we want the user input to go to.

We also have to include again.

Check 4.cpp for more details.

Functions in C++

So far the only function we have worked with has been the main() function.

Functions are like little containers of code.

<return type> <name>(<args>) { <code> }

That is the syntax for a function in C++.

So we have discussed data types in c++. The return type can be any of these.

It can also be a secret type.

This type is called void.

This means that the function returns nothing.

Lets declare a function together!

char giveBackChar(char x) { return x; }

Hopefully your functions will be more useful.

Check 5.cpp for more info.


Hey, so I'm making this a two-parter. This is part 1 and part 2 will come out soon!

2 years ago
You are viewing a single comment. View All

And each line of code in c++ must end with either a semicolon or bracket. In the case of regular code it must end in a semicolon.

*Cough, each statement must end with semi-colon.

Chars have 's around them and they are a single unicode character.

I wish. Yeah no, they store ASCII. You're looking for u8'C'.

You didn't differentiate between types and classes. :/

Strings need to be included via #include and they have "s around them they store multiple char types.

Not true at all. C has strings. C has quote surrounded strings. C++ has the exact same strings.

auto x = "Hola, Mundo!"; // C-String auto x = "Hola, Mundo!"s; // C++ std::string auto x = "Hola, Mundo!"sv; // C++ string view (Preffered)

Also, C++ has two different function declaration syntaxes:
The one you mentioned, of course:


,[object Object], ,[object Object], ,[object Object],[object Object]
2 years ago

Hey there buddy, if you care so much about beginners then why overwhelm them with this very rarely used stuff that they may never need. Okay, the ASCII instead of unicode argument. Fine, that is a solid point. But what beginner is going to use this other way to declare a function. And that is just an example. And for your other dumb rant going on about the semicolon thing, if you actually read instead of ranting on about it. You would see that I said that it needs to end in a semicolon or a bracket. A beginner wont know the terminology. They have no idea what a damn statement is.

knows nothing about writing tutorials. Zip, Zilch, Nada. And that is not even the beginning of your rhetoric.

2 years ago

You said this is for people coming from other languages, not new programmer level beginners, that is whom I was referring to. Are you suggesting that one who knows C# to an intermediate level doesn't know what a statement is!? You have already assumed that they know what a variable is, but not a statement? That's nonsense. Those are both require bare minimum competence in programming with a C-family language. The only people that I could expect to have a problem with understanding this would be those coming from Python, which would still be very easy to explain to them. C++ isn't a beginner language, but what you have given couldn't even help someone set up a program on their own. You barely gave any explanation on the core of that which makes C++... well, C++.

2 years ago

I don't have the time to continue this pointless garbage so I will leave you with this: what I said is much easier to understand than the whole statement thing and also gets the same job done as the statement thing.


2 years ago

idk why people are bashing. It seems to work great for me, as my only known lang is python. So all these people who know more languages, who may i add wasnt the targeted audience, saying that your all wrong, you cant just go into something describing every little detail. the human brain dosnt proccess information fast enough to keep up with that in a total of 5 minutes of reading. so good job to you my dude

2 years ago

Explaining every last detail is the last thing you should do, I did most of that as a joke. But in truth, it's just that this doesn't teach anything at all. It gives a few examples, doesn't explain any of it, and walks away claiming to have taught you something. You can't begin learning C++ looking at this. I would legitimately recommend HaHaYes's C tutorials over this.

2 years ago

It taught me the equivalent of print and input from python into c++. Which tbh could be enough to make a very simple text based game. Me personally as the subjected audience found it to work well for how short it was. But i see you would have a different perspective based on your experience level though so

2 years ago

thanks for the recommendation though

2 years ago

It's that I believe that one should have a depth of understanding, this is super shallow. I don't think you need to know the finest details of stuff, but at least a moderate comprehension of what you're working with. Now if this were just the beginning and in the next tutorial he explained it in more depth showed alternative, explained what everything does, etc, then it would be far more acceptable.

But when you say it's intended for those who already know what programming is, that's when it's too shallow.

For example, does it explain why you do std::cin >> x; instead of std::cin << x; or std::cin(x);? What does << even do? That's one of the key features of C++, that needs to eventually be explained. No, it doesn't need to be a day one thing, but it should be pointed out.

2 years ago

tbh HahaYes's tutorials are kinda bad. ik

's C++ tutorial isnt wonderful but ya gotta cut him some slack. He made tons of great tutorials that ive read before he left (i use this site to read tutorials) and this was kinda his last one (maybe he got burnt out or something) anyway, happy coding!

2 years ago

Good luck, I fully support trying to take whatever you can from a tutorial when you have the opportunity. It may not be great, but at least it's something. That goes to both HaHaYes, and JustAWalrus.

I'm actually going to go check out their ASM tutorials very soon and see if there's anything I can actually get out of them or apply to what I know.

2 years ago

you mean HahaYes's C++ Tutorials, not C. I think it was CodeLongandPros who made the C one... IDK

2 years ago

Oh yeah, it was, oops; I meant "C++" in that case.

2 years ago