SlideShare une entreprise Scribd logo
1  sur  12
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

Contenu connexe

Similaire à 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
 

Similaire à 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...
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 

Dernier (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 

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