crazycodigo

Crazy Codigo

Posted on August 7, 2022

A Roadmap to C++

By Suvendu Panda

Hey there. College lecturers going real fast in C++ and you can't keep up with it? Well, we got you.

To be honest, the shortcut to being fast and fluent in C++ is……..well, there is no shortcut except to practice and practice more.

Practice C++

But I can help you get started with the basics of C++.

Intro:

I hope you have an IDE(integrated development environment) installed on your laptop like Visual Studio Code, ubuntu, or any other compiler. If not, there are a lot of online compilers that can help you get what you want.

IDEs for C++

What do we want next?

We need to know the basics of C++. Open up your compiler and type in the basic “boring” code. The code goes like this:

#include<iostream>
using namespace std;
int main()
{
cout<<” HELLO WORLD ”;
return 0;
}
Enter fullscreen mode Exit fullscreen mode

Cannot understand any part of the program? No issues.

Just run the program and be familiar with your compiler. Check how the output screen is. Save the file correctly, and be sure to name it MYFIRSTPROGRAM.

Why? Because that is the law.

Next, we will learn what parts of this program do what.

The first line of the program: #include <iostream>.

<iostream> is a header file required to add a bunch of already defined functions to the program.

#include is used to direct the preprocessor to add the header file. There are a bunch of header files that we shall learn later, but the basics first.

What does int main() do?

int stands for integer which is a return type, or what kind of value the function will return after it has been executed.

main() is a function, a predefined function, that does not need a declaration. Anything in between {} parenthesis is called the body of the program, which is important because that is where the basic coding goes. That is where you tell the program what to do and what not to do.

In this case, we have a

cout<<"HELLO WORLD";
return 0; 
Enter fullscreen mode Exit fullscreen mode

in the body.

What is "cout"?

Basically, it is an object that is used to print the outputs we want to show in the terminal. The "<<" is the right shift operator which is followed just after a cout. Anything we want to print, like a text line, suppose your name, goes between " ".

For example,cout<<"HEY READER";.

To end a line we need to have a ";" at the end. That is the way how the compiler understands, oh, okay this is the end of the line, cool.

The last part of the program, the return 0;

Remember how we added intbefore the main function. This return 0 is used to return a "0" or null value at the end of the program.

There you have it, folks, you have understood the basics of the basics to C++. To learn even further, I would suggest you some of the websites or YouTube tutorials that can help you get better at it.

Here is a list of the YouTube channels that will help you get better at coding:

  • CodeBeauty

CodeBeauty YouTube channel

  • freeCodeCamp.org

freeCodeCamp.org YouTube channel

  • thenewboston

thenewboston YouTube channel

and many websites that can help you get going with the basics.

  • w3schools

w3schools.com

  • programiz

programiz.com

  • tutorialspoint

tutorialspoint

Once you are good with the basics I would suggest you go through some C++ projects so that you will be fluent with them.

THINGS TO KEEP IN MIND:

  • If you are learning with the help of YouTube tutorials, pause and type the codes by yourself, because there are many times when you face problems while writing the program on your own.

  • Keep taking notes. Make a rough copy or a digital note where you can include all the things that are required. That may be definitions, confusing codes, or syntax.

  • Note down where you are making mistakes, and keep a track of them.

  • Practice as much as you can.

Cya!
~ Suvendu

💖 💪 🙅 🚩
crazycodigo
Crazy Codigo

Posted on August 7, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

A Roadmap to C++
cpp A Roadmap to C++

August 7, 2022