Learn C++ in 6 Hours

Resources, Sample Code & Recommendations for learning C++.

Watch the full video (6 hours, Telugu) below or on my YouTube Channel.

What will you learn in this 6 hour tutorial?

By the end of this tutorial you will have full confidence & skills in below aspects of C++.

  • Setup:
    • Setting up VS Code, MinGW compilers and coding environment in your computer. 
  • Basic concepts:
    • HelloWorld program. C++ Program structure
    • Using Input / Ouput to read and print messages
    • Concept of variables, data types and mutation
    • Control flow – IF, Else, Switch
    • Loops – For, While, For Each
    • Functions – Pass by value, Pass by reference
  • Object Oriented Thinking:
    • Introduction to classes and objects
    • Class members
    • Initialization (constructors)
    • Overloading – Operators
    • Overloading – Functions
  • Standard Template Library:
    • Vectors, Arrays
  • File I/O:
    • Reading and writing to a file
    • Concept of buffers
  • End to End C++ Projects:
    • Simple Thermometer with C++
    • Expense Splitter with C++
    • Habit Tracker with C++ (Command Line App)
  • How to think and write programs, how to build coding confidence

Installing C++ on your computer

You need to download below software to get C++ on your computer.

Windows PCs:

Mac OS:

				
					# To check if C++ compilier is installed:
clang --version

# To install clang and other development compilers
xcode-select --install

				
			

VS Code Setup for C++ Development

Congratulations on installing VS Code & setting up the compilers. The next steps are important if you want to actually write, compile and execute C++ code. So don’t miss these.

1) Setup Environment Variables: 

Add the path of your MinGW-w64 bin folder to the Windows PATH environment variable by using the following steps:

  1. In the Windows search bar, type Settings to open your Windows Settings.
  2. Search for Edit environment variables for your account.
  3. In your User variables, select the Path variable and then select Edit.
  4. Select New and add the MinGW-w64 destination folder you recorded during the installation process to the list. If you used the default settings above, then this will be the path: C:\msys64\ucrt64\bin.
  5. Select OK, and then select OK again in the Environment Variables window to update the PATH environment variable. You have to reopen any console windows for the updated PATH environment variable to be available

[Source: VS Code Documentation]

2) Set up VS Code C++ Extensions

Open VS Code and go to Extensions (Ctrl Shift X) and search and install below extensions:

  • C/C++
  • C/C++ Extensions Pack
  • C/C++ Themes
  • Code Runner

Time to Code C++

Now that we have C++ and IDE (VS Code) set up in your computer, let’s get coding. Here is a simple helloworld program in CPP.

				
					#include <iostream>

int main()
{
    std::cout << "Hello, bagunnara?";

    return 0;
}
				
			

To write this program, Just open a new file in VS Code (File > New File) and type the code shown above. Then hit the run button in top right corner of the VS Code to execute your helloworld.cpp program. See this quick demo.

C++ Sample Code Files (Download)

I have prepared a few sample programs to understand various C++ concepts. Please download the code files by clicking on the download button below. Alternatively, you can access the files on my GitHub too. 

About the files

  • HelloWorld: A simple welcome program
  • variables: Understanding C++ variables and data types
  • passfail: Explanation of control flow with IF / Else
  • chitti: a simple command line bot with C++
  • thermo: simple thermometer mini-project
  • loops: Understanding for / while loops in C++
  • nested: nesting loops and conditions
  • split: an expense splitter with C++
  • functions: Explanation of C++ functions
  • student_examples: Classes, objects with C++
  • Habit Tracker: C++ CLI Project to build a habit tracker app (with various files all in this folder)

Github Repository | Download the code files

C++ Learning References

  • LearnCPP.com: Perfect website with lots of tutorials, detailed explanation and examples on all aspects of C++ and libraries. Must have resource for any serious programmer or learner.
  • CPPReference.com for an exhaustive reference of various STL (Standard Template Libraries) and Algorithms. Use it to understand how classes like Vector, Set, Map, Queue, Stack etc. work, as well as how algorithms like search, sort can be accessed.

Recommended Books:

Happy Learning...

All the best for your C++ Learning and coding mastery.

Got a question or feedback? Leave a comment below.

2 Responses to “Learn C++ in 6 Hours – Sample Files, Instructions and References”

  1. Pavan Burra says:

    Sir, as per your mention in C++ course is it ok to consider it will be enough to for a beginner to complete the entire course to ahead to
    DSA??

    Sir, as you mentioned a name which is same with my surname check mine once..

    • Chandoo says:

      Yes, this should be sufficient for beginners to understand how C++ works, how to think in OO programming and gain confidence.
      Late Burra Venkata Narayana garu is my Maths teacher and one of the greatest human beings. I wanted to acknowledge the impact he had on me with this small tribute.

Leave a Reply