C++ is a very important programming language, even though python is really hot in today's AI context.
This is a basic tutorial of C++ for beginners. From Basic Datatypes to Standard Template Library(STL).
It is mainly based on the book C++ in One Hour a Day, Sams Teach Yourself(8th Edition).
-------Update 2020-3-1-------
Adding a "A Deep Understanding of STL's Source Code" part in Chinese.
- Visual Studio is highly recommended if you do c++ development on Windows or Mac. It is free(the community version), and powerful, which is suited to large project development.
- Clion is also highly recommended. It is cross-platform(pc, mac, linux), powerful and easy to compile and debug. But it is not free and don't have the community version. If you are a student, you can apply for a free individual license for one year.
- Some lightweight tools: Code Blocks | Visual Studio Code | Qt, open source version
- Online IDE runs in browser: Cpp Online
Error after you type in you username and password: Can not connect to the remove sever, ...
, then you should edit your hosts file(/etc/hosts
on Linux) to comment the urls that related to JetBrains
.
#include <iostream>
int main(){
std::cout << "Hello World!" << std::endl;
return 0;
}
First, I assume that you have some basic knowledge of C or C++.
Before we start, let's walk through the Basic Introduction About C++ roughly to recall some basic and important points. (All the codes in this introduction are from this tutorial video: https://www.youtube.com/watch?v=vLnPwxZdW4Y, I just sort the video content into text form.)
-
Part I, The Basics.
- Lesson 1 - Getting Start
- Lesson 2 - The Anatomy of a C++ Program
- Lesson 3 - Using Variables, Declaring Constants
- Lesson 4 - Managing Arrays and Strings
- Lesson 5 - Working with Expressions, Statements, and Operators
- Lesson 6 - Controlling Program Flow
- Lesson 7 - Organizing Code with Functions
- Lesson 8 - Pointers and References Explained
-
Part II, Fundamentals of Object-Oriented C++ Programming.
-
Part III, Learning the Standard Template Library (STL).
-
Part IV, More STL.
-
Part V, Advanced C++ Concepts.