C++ Getting Started

Prateek Narang
Agenda
-
C++ Introduction
-
C++ Applications
-
Boilerplate
-
Input Output
- Add numbers


- C++ is a cross-platform language that can be used to create high-performance applications.
- C++ was developed by Bjarne Stroustrup, in 1979 at Bell Labs as an extension to the C language.
- C++ gives programmers a high level of control over system resources and memory.
- The language was updated multiple times leading to versions C++11, C++14, C++17, C++ 20.

Introduction to C++


C++ Superpower 🔥
SPEED
- C++ can be found in code of operating systems
- Graphical User Interfaces & embedded systems
- Many gaming engines are written in C++
- Web-browsers like Mozilla, Chrome are written in C++
- Compilers for many languages are written in C++
- Banking Applications
- Libraries & frameworks for Machine Learning like Tensor-flow by Google.

Where it is used?

Code - A Quick Look 👀


Boilerplate
#include <iostream>
using namespace std;
int main() {
// Your Code goes here
return 0;
}

Hello World!
#include <iostream>
using namespace std;
int main() {
// Your Code goes here
cout << "Hello World!";
return 0;
}
How to run C++ Code? 🧐

- An integrated development environment (IDE) is software for building applications that combines common developer tools into a single graphical user interface (GUI)
- To run a C++ on our machine, we need
- Text Editor
- C++ Compiler
- Command Line / Terminal to invoke the compiler

IDE

ide.new

Online IDE by InterviewBit

#include <iostream>
using namespace std;
int main() {
cout << "Hello World!";
return 0;
}

Input - Output

Variables
To store data from user input we need to create buckets in the memory, the buckets are called Variables. Each variable is of a certain datatype.

Variables Demo
Let's take an example of Integer variables, that can hold an integer type of data.

Challenge

Take input 3 numbers and print their sum.

Summary
- Header files contain some predefined code.
- Every C++ program starts execution from main function.
- We can write comments in the code, which are ignored by the compiler.
- main() is the entry point of the program.
- We use 'cin' object for Input and 'cout' for Output.
- We need to create variables to store data.
[Topics 02] C++ Getting Started
By Prateek Narang
[Topics 02] C++ Getting Started
- 13