Introduction To C++ Programming
Introduction To C++ Programming
C++
PROGRAMMING
Prepared by: Jhanine Abendan
Course Objectives
Understand the fundamental concepts of C++
programming.
Understand the role and significance of C++ in the
industry.
The concept of data types, tokens, input/output
operators, control statements and other C++
programming characteristics will be discussed to
strengthen the students’ foundation in the
development of programs.
Develop programs using C++ applying the
fundamental OOP concepts.
Course Outline
PART I PART III
?
1967 ?
1969-1973 ?
1979 ?
1983 ?
1985-1989 ?
2011
-2014
C++11 standard
The C language C with classes released
was invented by renamed to C+ C++14 released
Dennis Ritchie and +
Bell Labs
WHY C++ ?
PROS CONS
1. Better performance 1. Python, R, Matlab and
when dealing with other scripting
large amounts of data languages are faster
and ability to handle and easier to produce
complex algorithms. code.
2. Java uses c++ syntax 2. Not the easiest
and lots of good paying language to learn but
jobs for programmers. not the hardest either.
WHO USES C++ ?
● Computer makers such as Sun, SGI, IBM
and HP.
● Airport
● Computer chip manufacturers like
Motorola & Intel
● Software companies
● Banks
● Hongkong Government
● Hospital
● Telecommunications
● Universities
General Structure of C++
Program
—SOMEONE FAMOUS
BASIC COMPONENTS OF C++
• PROGRAM
Comments or Documentation Section
• /* A Comment */ or // remainder of line ignored
• Pre-processor Directives (Linker Section)
• #include <iostream>
• Main () function
___
• Constant Declaration
• Ex: int I = 5;
• Variable Declaration
• Ex: int sum;
• Executable Statements
• cout << "Hello World" << endl;
C++ INTRODUCTION
Identifiers
Name given to programming elements
such as variables, functions, objects. i.e
Student, _dos
Keywords
Predefined word that gives
special meaning to the
TOKENS compiler
Literals
Smallest individual Literals / Constant are identifiers
unit in a program whose value does not change during
program execution.
Operators
Used to perform operations on
variables and values
IDENTIFIERS
Rules to be followed while creating
identifiers:
1. Should begin with either A-Z
(uppercase) or a-z (lowercase) or _
(underscore)
2. C++ treats uppercase and
lowercase differently
3. No special character allowed
except underscore
4. Should be single words. Blank
space cannot be included.
5. Reserved keywords should not be
Keywords
Despite being red, Mars
is actually a cold place
Keywords
Predefined word
that gives special
meaning to the
compiler
LITERALS / CONSTANT
Literals / Constant are identifiers whose value does not change during
program execution. A constant or literal maybe anyCharacter
one of the following:
Integer Constant
Constant
Whole number; Specified as single
either positive or negative; character enclosed in
Do not have fractional part or pair of quotation
exponent; mark;
Floating String
Constant Constant
Also called as real Zero or more character
constants; enclosed by double quotation
Values contains decimal marks;
point; Multiple character (array of
Can contain exponent or Char);
C++ INTRODUCTION
Arithmetic
Perform common mathematical
operations. i.e addition, subtraction,
multiplication, division. etc
Assignment
Used to assign values to
OPERATO variables. i.e = , += ,
RS
Used to perform
Relational
-=
Used to compare two values.
operations on variables i.e < , <= , > , >=
and values Logical
Used to determine logic
between variables or values
i.e && , || , ! ,
C++ CHARACTER SET
Initial Algorithm:
1. Read the number of nickels and pennies.
2. Compute the total value in US dollars.
3. Compute the corresponding total value in
Philippine peso.
4. Display the number of Philippine peso
coins.
REFERENCES
Introduction to C++ ppt by Dr. Prof. K. Adisesha