Programming in C++
Programming in C++
Programming in C++
in C++
Introduction to C++
C++ is a general-purpose
programming language that was
developed as an enhancement of the
C language to include object-oriented
paradigm. It is an imperative and
a compiled language
• C++ is a middle-level language rendering it the
advantage of programming low-level (drivers,
kernels) and even higher-level applications
(games, GUI, desktop apps etc.). The basic
syntax and code structure of both C and C++
are the same.
Some of the features & key-points to note about the
programming language are as follows :
• Simple
• Platform Dependent
• Mid-Level Language
• Rich library Support
• Speed of Execution
• Pointer and Direct Memory Access
• Object oriented
• Compiled Language
Applications of C++:
• Operating Systems & Systems Programming.
e.g. Linux-based OS (Ubuntu etc.)
• Browsers (Chrome & Firefox)
• Graphics & Game engines (Photoshop,
Blender, Unreal-Engine)
• Database Engines (MySQL, MongoDB, Redis
etc.)
• Cloud/Distributed Systems
Syntax of C++
• #include <iostream>
• using namespace std;
Used to join
On-page Connector
different flowline
Used to connect the
Off-page Connector flowchart portion on
a different page.
Represents a group
Predefined of statements
Process/Function performing one
processing task.
Examples of flowcharts in
programming
• 1. Add two numbers entered by the user.
• 2. Find the largest among three different numbers entered by the user.
Introduction to C++ Algorithm
• The finite set of steps arranged sequentially
which acts as a guide to solve any problem.
This c++ algorithm word is particularly
used in computer science to define the
procedure for solving complex problems. The
architecture of the solution can be different
for different algorithms.
Example1
• Write a C++ algorithm to write a program to add two
numbers.
• Algorithm
• Steps are given below:
• Start
• Accept num1, num 2
• Sum= num1+ num2
• Display sum
• Stop
Example2
• Write a C++ algorithm to determine if a student is pass or fail based on the
grades. Grades are the average of total marks obtained in all the subjects.
• Algorithm
• Steps are given below:
• Start
• Input Marks1, Marks2, Marks3, Marks4
• Grade= (Marks1+Marks2+Marks3+Marks4)/4
• If (Grade<50) then
• Print “Fail”
• Else
• Print “Pass”
• End if
• Stop