Author: Vanshika Kansal
Year: 2019
Email: [email protected]
Welcome to the C++ Tutorial GitHub Wiki Page!
This repository contains C++ lecture slides including sample codes that I adopted from various sources. These lecture try to help newcomers to learn C++ and solve their programming problems. This is assumed that readers are already familiar with C, or at least that they do not have any difficulty in reading C code. In other words, those who have experience in C and people who desire to quickly understand the features of modern C++ in a short period of time are well suited togo throgh these lectures.
The objective of this tutorial is to provide a basic introduction to beginners. The level is aimed at individuals with little or no experience whatsoever with C++. This tutorial is more focused on the basics of C/C++. The main features covered in this tutorial are:
- Variables -- one of the basic building blocks of computer programs.
- How to make and execute a program.
- How to make our program interactive, by getting input from the user and printing output.
- If-else statement: allows you to introduce a whole new level of interactivity and complexity to your program, conditionally executing code based on user input or calculations.
- The switch statement allows you to choose between multiple alternatives in C++, like a more efficient and tidier if-else if-else.
- Loops allowing you to control the number of loop iterations in a very flexible way.
- Postfix and prefix increment and decrement in C++.
- Arrays let you work with lists of data items, a lot like a shopping list, where item is numbered.
- Pointers are the point at which many beginners give up with C++. They seem like a bit of a mind game when you first start, but as with everything else in programming, if you practice typing, your understanding of them will develop surprisingly.
- Close relationship between pointers and arrays in C++.
- Functions are one of the most exciting steps when you're learning programming; finally you can create blocks of reusable code.
- Simple little tutorial on Namespaces let you create self-contained collections of functions in C++, avoiding clashes with similarly-named functions.]-
The objective of this tutorial is to provide a introduction to object-oriented Programming.
- Classes are all the rage these days in programming, enabling you to model real-world or programming concepts by bundling together code with data.
- Constructors and Destructors are special methods that are run when your objects are created and destroyed respectively. You can use constructors to initialize your objects.
- Add data to our C++ classes, enabling us to model such things as cats and people
- Inheritance is one of the reasons why object-oriented programming is so great, allowing you to create objects based on existing objects, but adding new functionality. Beginners often ask if programmers really use this stuff, and the answer is an emphatic yes --- although not every program requires inheritance. But for some types of programs, especially ones involving an interface or games, inheritance is extremely useful and leads to elegant, maintainable code.
- Often you want to copy an object in C++. For simple objects containing only primitive datatypes, this just "works" by default, but for anything more complicated you need to define a copy constructor.
The objective of this tutorial is to provide a more in-depth look at object-oriented Programming and Exception handling.
- Virtual function defines an interface to derived classes that can be used without looking at the derived classes.
- Frequent use of the "const" keyword in C++ can really help to reduce the likelihood of bugs in your program, which in C++ is a great thing, since C++ is unfortunately a great language for creating bugs.
- The inline functions which increases the execution time of a program by replacing the definition of inline functions at compile time instead of referring function definition at runtime
- Exception handling allows code to break control flow when an exception is thrown.
The objective of this tutorial is to provide a brief overview about STL and templates.
- Templates allows the re-usability, letting it accepts using different types of objects but one type at the same type.
- When you set up a C++ project, very often you'll be working with a third-party "API" (Application Programming Interface). In short, you use some code in your program from somewhere else, saving you often a vast amount of time and trouble. We'll take a look at the different kinds of standard C++ libraries.