SlideShare a Scribd company logo
IT1050| Object Oriented Concepts| Introduction to C++| AG
IT1050-Object Oriented Concepts
Lecture-01 - Introduction to C++
1
IT1050| Object Oriented Concepts| Introduction to C++| AG
Learning Outcomes
At the end of the Lecture students should be able to
Write a basic C++ program including :
- Output commands
2
IT1050| Object Oriented Concepts| Introduction to C++| AG
C++
• One of the most powerful and popular programming languages
• Evolve from C
• Developed by Bjarne Stroustrup in 1979 at Bell Laboratories
• Provide capabilities for Object Oriented Programming
• Current Version – C++ 17
3
IT1050| Object Oriented Concepts| Introduction to C++| AG
C vs C++
4
// C Program
#include <stdio.h>
void main ( void)
{
printf (“Hello World ! n”);
}
// C++ Program
#include <iostream>
int main ( )
{
std::cout<< “Hello World !“ ;
std::cout<< std::endl;
return 0;
}
Hello World !
Output :
IT1050| Object Oriented Concepts| Introduction to C++| AG
First C++ Program
5
// C++ Program : prg_01.cpp
//Printing a String
#include <iostream> // allows program to output data to the screen
int main ( ) // Function main begins program execution
{
std::cout<< “Hello World !“; // Display message
std::cout<< std::endl; // New line
return 0; // indicate that program ended successfully
} // End of main function
IT1050| Object Oriented Concepts| Introduction to C++| AG
Comments
• Comments provide information to the people who read the program
• Comments are removed by the preprocessor, therefore the compiler
ignores them
• In C++, there are two types of comments
• Single line comments //
• Delimited comments /* */ for comments with more than one line.
6
// C++ Program : prg_01.cpp
//Printing a String
IT1050| Object Oriented Concepts| Introduction to C++| AG
Preprocessing Directives
• Lines begin with # are processed by the preprocessor before the
program is compiled.
• Notifies the preprocessor to include in the program the content of the
input/output stream header <iostream>
• “iostream” is a header file containing information used by the compiler
when compiling a program with output data to screen or input data
from the keyboard using c++ input/output stream
7
#include <iostream>
IT1050| Object Oriented Concepts| Introduction to C++| AG
The main function
• C++ programs begin executing at function main.
• It is the main building block of a program.
• int indicates that main returns an integer value.
• { ( left brace ) indicates the begin of the main body and } ( right brace )
indicates the end of the function’s body.
8
int main()
{
}
IT1050| Object Oriented Concepts| Introduction to C++| AG
Output Statement
• cout : to indicate the computer to output
something on screen
• << : is the stream insertion operator used
to send information to cout
• “Hello World !” :String / String Literal. What you need
to display on screen
• ; : statement terminator
9
std:: cout<< “Hello World ! “ ;
IT1050| Object Oriented Concepts| Introduction to C++| AG
New Line
• endl : to go to a new line ( same as “n”)
eg : std::cout<<“n”;
10
std:: cout<< endl ;
std:: cout<< “Hello World !”<< endl ;
Hello World !
_
Output :
IT1050| Object Oriented Concepts| Introduction to C++| AG
Exercise
• Write a C++ program to display your name
and address in 3 lines.
11
IT1050| Object Oriented Concepts| Introduction to C++| AG
Reference
12
Chapter 01 & 02
Deitel & Deitel’s (2016), C++ How to Program,
9th Edition

More Related Content

Similar to Lecture-01-2020J.pptx

Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
meharikiros2
 

Similar to Lecture-01-2020J.pptx (20)

Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
IITK ESC 111M Lec02.pptx .
IITK ESC 111M Lec02.pptx               .IITK ESC 111M Lec02.pptx               .
IITK ESC 111M Lec02.pptx .
 
C++
C++C++
C++
 
ICT1002-W8-LEC-Introduction-to-C.pdf
ICT1002-W8-LEC-Introduction-to-C.pdfICT1002-W8-LEC-Introduction-to-C.pdf
ICT1002-W8-LEC-Introduction-to-C.pdf
 
Introduction to C++,Computer Science
Introduction to C++,Computer ScienceIntroduction to C++,Computer Science
Introduction to C++,Computer Science
 
What is c++ programming
What is c++ programmingWhat is c++ programming
What is c++ programming
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
 
Unit 1 of c++ first program
Unit 1 of c++ first programUnit 1 of c++ first program
Unit 1 of c++ first program
 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to it
 
General structure of c++
General structure of c++General structure of c++
General structure of c++
 
Introduction to programming
Introduction to programmingIntroduction to programming
Introduction to programming
 
8.3 program structure (1 hour)
8.3 program structure (1 hour)8.3 program structure (1 hour)
8.3 program structure (1 hour)
 
Lab 1.pptx
Lab 1.pptxLab 1.pptx
Lab 1.pptx
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
 
Sachin kumar ppt on programming in c
Sachin kumar ppt on programming in cSachin kumar ppt on programming in c
Sachin kumar ppt on programming in c
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 

Recently uploaded

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 

Recently uploaded (20)

How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdfDanh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
Danh sách HSG Bộ môn cấp trường - Cấp THPT.pdf
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 

Lecture-01-2020J.pptx

  • 1. IT1050| Object Oriented Concepts| Introduction to C++| AG IT1050-Object Oriented Concepts Lecture-01 - Introduction to C++ 1
  • 2. IT1050| Object Oriented Concepts| Introduction to C++| AG Learning Outcomes At the end of the Lecture students should be able to Write a basic C++ program including : - Output commands 2
  • 3. IT1050| Object Oriented Concepts| Introduction to C++| AG C++ • One of the most powerful and popular programming languages • Evolve from C • Developed by Bjarne Stroustrup in 1979 at Bell Laboratories • Provide capabilities for Object Oriented Programming • Current Version – C++ 17 3
  • 4. IT1050| Object Oriented Concepts| Introduction to C++| AG C vs C++ 4 // C Program #include <stdio.h> void main ( void) { printf (“Hello World ! n”); } // C++ Program #include <iostream> int main ( ) { std::cout<< “Hello World !“ ; std::cout<< std::endl; return 0; } Hello World ! Output :
  • 5. IT1050| Object Oriented Concepts| Introduction to C++| AG First C++ Program 5 // C++ Program : prg_01.cpp //Printing a String #include <iostream> // allows program to output data to the screen int main ( ) // Function main begins program execution { std::cout<< “Hello World !“; // Display message std::cout<< std::endl; // New line return 0; // indicate that program ended successfully } // End of main function
  • 6. IT1050| Object Oriented Concepts| Introduction to C++| AG Comments • Comments provide information to the people who read the program • Comments are removed by the preprocessor, therefore the compiler ignores them • In C++, there are two types of comments • Single line comments // • Delimited comments /* */ for comments with more than one line. 6 // C++ Program : prg_01.cpp //Printing a String
  • 7. IT1050| Object Oriented Concepts| Introduction to C++| AG Preprocessing Directives • Lines begin with # are processed by the preprocessor before the program is compiled. • Notifies the preprocessor to include in the program the content of the input/output stream header <iostream> • “iostream” is a header file containing information used by the compiler when compiling a program with output data to screen or input data from the keyboard using c++ input/output stream 7 #include <iostream>
  • 8. IT1050| Object Oriented Concepts| Introduction to C++| AG The main function • C++ programs begin executing at function main. • It is the main building block of a program. • int indicates that main returns an integer value. • { ( left brace ) indicates the begin of the main body and } ( right brace ) indicates the end of the function’s body. 8 int main() { }
  • 9. IT1050| Object Oriented Concepts| Introduction to C++| AG Output Statement • cout : to indicate the computer to output something on screen • << : is the stream insertion operator used to send information to cout • “Hello World !” :String / String Literal. What you need to display on screen • ; : statement terminator 9 std:: cout<< “Hello World ! “ ;
  • 10. IT1050| Object Oriented Concepts| Introduction to C++| AG New Line • endl : to go to a new line ( same as “n”) eg : std::cout<<“n”; 10 std:: cout<< endl ; std:: cout<< “Hello World !”<< endl ; Hello World ! _ Output :
  • 11. IT1050| Object Oriented Concepts| Introduction to C++| AG Exercise • Write a C++ program to display your name and address in 3 lines. 11
  • 12. IT1050| Object Oriented Concepts| Introduction to C++| AG Reference 12 Chapter 01 & 02 Deitel & Deitel’s (2016), C++ How to Program, 9th Edition