SlideShare a Scribd company logo
1 of 2
Download to read offline
Intro to C/C++ Intro to Programming
MUHAMMAD HAMMAD WASEEM 1
INTRODUCTION
C++, pronounced as “See Plus Plus”, is a powerful computer programming language. It is the
advance version of C language. The C is a procedural language while the C++ is an object oriented
programming language.
STRUCTURE OF C++ PROGRAMS
A C/C++ program consists of three main parts. These are:
 Preprocessor Directives
 The main function
 C/C++ statements
Preprocessors Directives
The instructions that are given to the compiler before the beginning of the actual program are
called Preprocessor Directives. These are also known as Compiler Directives. The compiler adds special
instructions or code from these directives into the program at the time of compilation.
These preprocessor directives normally stat with a number sign (#) and the keyword “include”
or “define”.
A program example is given below. The first statement of the program is preprocessor directive.
This preprocessor has been written to include the iostream.h header file in C++ and stdio.h in C.
C Language C++ Language
#include <stdio.h>
main()
{
printf(”this is my first
program”);
}
#include <iostream.h>
main()
{
cout<<”this is my first program”;
}
Header File
Header file in C/C++ source file that contains definitions of library functions /objects. Header files
are added into the program at the compilation of the program.
The preprocessor directive “include” is used to add a header file into the program. The name of
the file is written in angle brackets (< >) after “#include” directives. It can also be written in double
quotes. The header file stdio.h / iostream.h has definitions of different built-in input and output objects
and functions. The syntax of the header file is:
#include <name of the header file>
The main () Function
The main function indicates the beginning of a C/C++ program. The main () must be included in
every C/C++ program. When a C/C++ program is executed, the control goes directly to the main ()
function. The statements within this function are the main body of the C/C++ program. If main () function
is not included, the program is not compiled and an error message is generated.
The syntax of the main function is:
main ()
{ Programs statements…. }
Intro to C/C++ Intro to Programming
MUHAMMAD HAMMAD WASEEM 2
C++ Statements
The statements of the program are written under the main () function between the curly braces
{}. These statements are the body of the program. Each statement in C/C++ ends with a semicolon (;).
C/C++ is a case sensitive language. The C/C++ statements are normally written in lowercase
letters but in some exceptional cases, these can also be written in uppercase.
Keywords
The words that are used by the language for special purposes are called keywords. These are also
called reserved words. For example, in a C/C++ program, the word main is used to indicate the starting
of program, int to declare an integer type variable etc.
These keywords cannot be used as variable names in a program.

More Related Content

What's hot

Intoduction to c language
Intoduction to c languageIntoduction to c language
Intoduction to c languageStudent
 
C programming introduction
C programming introductionC programming introduction
C programming introductionDucat
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEMMansi Tyagi
 
Chapter 13.1.4
Chapter 13.1.4Chapter 13.1.4
Chapter 13.1.4patcha535
 
Planning to computer program(southeast university)
Planning to computer program(southeast university)Planning to computer program(southeast university)
Planning to computer program(southeast university)Arup deb nath
 
C introduction
C introductionC introduction
C introductionKamran
 
presentation on the topic: Introduction to the C language
presentation on the topic: Introduction to the C languagepresentation on the topic: Introduction to the C language
presentation on the topic: Introduction to the C languageGautamGupta136
 
How to execute a C program
How to execute a C  program How to execute a C  program
How to execute a C program Leela Koneru
 
Computer programming chapter ( 3 )
Computer programming chapter ( 3 ) Computer programming chapter ( 3 )
Computer programming chapter ( 3 ) Ibrahim Elewah
 
C programming course material
C programming course materialC programming course material
C programming course materialRanjitha Murthy
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTBatra Centre
 

What's hot (20)

Lect '1'
Lect '1'Lect '1'
Lect '1'
 
C programming
C programmingC programming
C programming
 
Intoduction to c language
Intoduction to c languageIntoduction to c language
Intoduction to c language
 
Programming in c
Programming in cProgramming in c
Programming in c
 
C programming introduction
C programming introductionC programming introduction
C programming introduction
 
OVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAMOVERVIEW OF ‘C’ PROGRAM
OVERVIEW OF ‘C’ PROGRAM
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEM
 
Chapter 13.1.4
Chapter 13.1.4Chapter 13.1.4
Chapter 13.1.4
 
Planning to computer program(southeast university)
Planning to computer program(southeast university)Planning to computer program(southeast university)
Planning to computer program(southeast university)
 
C introduction
C introductionC introduction
C introduction
 
Intro to c++
Intro to c++Intro to c++
Intro to c++
 
presentation on the topic: Introduction to the C language
presentation on the topic: Introduction to the C languagepresentation on the topic: Introduction to the C language
presentation on the topic: Introduction to the C language
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
How to execute a C program
How to execute a C  program How to execute a C  program
How to execute a C program
 
Assembler
AssemblerAssembler
Assembler
 
Computer programming chapter ( 3 )
Computer programming chapter ( 3 ) Computer programming chapter ( 3 )
Computer programming chapter ( 3 )
 
Presentation on C programming language
Presentation on C programming languagePresentation on C programming language
Presentation on C programming language
 
C language
C languageC language
C language
 
C programming course material
C programming course materialC programming course material
C programming course material
 
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTTC programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
C programming notes BATRACOMPUTER CENTRE IN Ambala CANTT
 

Similar to [ITP - Lecture 03] Introduction to C/C++

Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Rumman Ansari
 
C Programming Language Step by Step Part 2
C Programming Language Step by Step Part 2C Programming Language Step by Step Part 2
C Programming Language Step by Step Part 2Rumman Ansari
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptxMugilvannan11
 
Structure of C program
Structure of C programStructure of C program
Structure of C programMegha Sharma
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c languagefarishah
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeksAashutoshChhedavi
 
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 itPushkarNiroula1
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5REHAN IJAZ
 
Chapter 3(1)
Chapter 3(1)Chapter 3(1)
Chapter 3(1)TejaswiB4
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)aaravSingh41
 
Stucture of c program
Stucture of c programStucture of c program
Stucture of c programVpmv
 
My first program in c, hello world !
My first program in c, hello world !My first program in c, hello world !
My first program in c, hello world !Rumman Ansari
 
C++ language basic
C++ language basicC++ language basic
C++ language basicWaqar Younis
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programmingTejaswiB4
 

Similar to [ITP - Lecture 03] Introduction to C/C++ (20)

C++ Chapter 3
C++ Chapter 3C++ Chapter 3
C++ Chapter 3
 
Basic c programming and explanation PPT1
Basic c programming and explanation PPT1Basic c programming and explanation PPT1
Basic c programming and explanation PPT1
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
C Programming Language Step by Step Part 2
C Programming Language Step by Step Part 2C Programming Language Step by Step Part 2
C Programming Language Step by Step Part 2
 
C Programming UNIT 1.pptx
C Programming  UNIT 1.pptxC Programming  UNIT 1.pptx
C Programming UNIT 1.pptx
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
 
PPs16.pptx
PPs16.pptxPPs16.pptx
PPs16.pptx
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
C PROGRAMMING p-2.pdf
C PROGRAMMING p-2.pdfC PROGRAMMING p-2.pdf
C PROGRAMMING p-2.pdf
 
C language introduction geeksfor geeks
C language introduction   geeksfor geeksC language introduction   geeksfor geeks
C language introduction geeksfor geeks
 
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
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
 
Chapter 3(1)
Chapter 3(1)Chapter 3(1)
Chapter 3(1)
 
Unit 2 l1
Unit 2 l1Unit 2 l1
Unit 2 l1
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)
 
Stucture of c program
Stucture of c programStucture of c program
Stucture of c program
 
My first program in c, hello world !
My first program in c, hello world !My first program in c, hello world !
My first program in c, hello world !
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
C structure
C structureC structure
C structure
 
Basic structure of c programming
Basic structure of c programmingBasic structure of c programming
Basic structure of c programming
 

More from Muhammad Hammad Waseem

[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++Muhammad Hammad Waseem
 
[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to Pointers[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to PointersMuhammad Hammad Waseem
 
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++Muhammad Hammad Waseem
 
[ITP - Lecture 09] Conditional Operator in C/C++
[ITP - Lecture 09] Conditional Operator in C/C++[ITP - Lecture 09] Conditional Operator in C/C++
[ITP - Lecture 09] Conditional Operator in C/C++Muhammad Hammad Waseem
 
[ITP - Lecture 08] Decision Control Structures (If Statement)
[ITP - Lecture 08] Decision Control Structures (If Statement)[ITP - Lecture 08] Decision Control Structures (If Statement)
[ITP - Lecture 08] Decision Control Structures (If Statement)Muhammad Hammad Waseem
 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of PrecedenceMuhammad Hammad Waseem
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++Muhammad Hammad Waseem
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member FunctionsMuhammad Hammad Waseem
 
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnTypeMuhammad Hammad Waseem
 
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its TypesMuhammad Hammad Waseem
 
[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their Accessing[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their AccessingMuhammad Hammad Waseem
 

More from Muhammad Hammad Waseem (20)

[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++[ITP - Lecture 17] Strings in C/C++
[ITP - Lecture 17] Strings in C/C++
 
[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++[ITP - Lecture 16] Structures in C/C++
[ITP - Lecture 16] Structures in C/C++
 
[ITP - Lecture 15] Arrays & its Types
[ITP - Lecture 15] Arrays & its Types[ITP - Lecture 15] Arrays & its Types
[ITP - Lecture 15] Arrays & its Types
 
[ITP - Lecture 14] Recursion
[ITP - Lecture 14] Recursion[ITP - Lecture 14] Recursion
[ITP - Lecture 14] Recursion
 
[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to Pointers[ITP - Lecture 13] Introduction to Pointers
[ITP - Lecture 13] Introduction to Pointers
 
[ITP - Lecture 12] Functions in C/C++
[ITP - Lecture 12] Functions in C/C++[ITP - Lecture 12] Functions in C/C++
[ITP - Lecture 12] Functions in C/C++
 
[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++[ITP - Lecture 11] Loops in C/C++
[ITP - Lecture 11] Loops in C/C++
 
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
[ITP - Lecture 10] Switch Statement, Break and Continue Statement in C/C++
 
[ITP - Lecture 09] Conditional Operator in C/C++
[ITP - Lecture 09] Conditional Operator in C/C++[ITP - Lecture 09] Conditional Operator in C/C++
[ITP - Lecture 09] Conditional Operator in C/C++
 
[ITP - Lecture 08] Decision Control Structures (If Statement)
[ITP - Lecture 08] Decision Control Structures (If Statement)[ITP - Lecture 08] Decision Control Structures (If Statement)
[ITP - Lecture 08] Decision Control Structures (If Statement)
 
[ITP - Lecture 07] Comments in C/C++
[ITP - Lecture 07] Comments in C/C++[ITP - Lecture 07] Comments in C/C++
[ITP - Lecture 07] Comments in C/C++
 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
 
[ITP - Lecture 05] Datatypes
[ITP - Lecture 05] Datatypes[ITP - Lecture 05] Datatypes
[ITP - Lecture 05] Datatypes
 
[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++[ITP - Lecture 04] Variables and Constants in C/C++
[ITP - Lecture 04] Variables and Constants in C/C++
 
[OOP - Lec 20,21] Inheritance
[OOP - Lec 20,21] Inheritance[OOP - Lec 20,21] Inheritance
[OOP - Lec 20,21] Inheritance
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
 
[OOP - Lec 18] Static Data Member
[OOP - Lec 18] Static Data Member[OOP - Lec 18] Static Data Member
[OOP - Lec 18] Static Data Member
 
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
[OOP - Lec 16,17] Objects as Function Parameter and ReturnType
 
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
 
[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their Accessing[OOP - Lec 09,10,11] Class Members & their Accessing
[OOP - Lec 09,10,11] Class Members & their Accessing
 

Recently uploaded

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxElton John Embodo
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Recently uploaded (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
EMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docxEMBODO Lesson Plan Grade 9 Law of Sines.docx
EMBODO Lesson Plan Grade 9 Law of Sines.docx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

[ITP - Lecture 03] Introduction to C/C++

  • 1. Intro to C/C++ Intro to Programming MUHAMMAD HAMMAD WASEEM 1 INTRODUCTION C++, pronounced as “See Plus Plus”, is a powerful computer programming language. It is the advance version of C language. The C is a procedural language while the C++ is an object oriented programming language. STRUCTURE OF C++ PROGRAMS A C/C++ program consists of three main parts. These are:  Preprocessor Directives  The main function  C/C++ statements Preprocessors Directives The instructions that are given to the compiler before the beginning of the actual program are called Preprocessor Directives. These are also known as Compiler Directives. The compiler adds special instructions or code from these directives into the program at the time of compilation. These preprocessor directives normally stat with a number sign (#) and the keyword “include” or “define”. A program example is given below. The first statement of the program is preprocessor directive. This preprocessor has been written to include the iostream.h header file in C++ and stdio.h in C. C Language C++ Language #include <stdio.h> main() { printf(”this is my first program”); } #include <iostream.h> main() { cout<<”this is my first program”; } Header File Header file in C/C++ source file that contains definitions of library functions /objects. Header files are added into the program at the compilation of the program. The preprocessor directive “include” is used to add a header file into the program. The name of the file is written in angle brackets (< >) after “#include” directives. It can also be written in double quotes. The header file stdio.h / iostream.h has definitions of different built-in input and output objects and functions. The syntax of the header file is: #include <name of the header file> The main () Function The main function indicates the beginning of a C/C++ program. The main () must be included in every C/C++ program. When a C/C++ program is executed, the control goes directly to the main () function. The statements within this function are the main body of the C/C++ program. If main () function is not included, the program is not compiled and an error message is generated. The syntax of the main function is: main () { Programs statements…. }
  • 2. Intro to C/C++ Intro to Programming MUHAMMAD HAMMAD WASEEM 2 C++ Statements The statements of the program are written under the main () function between the curly braces {}. These statements are the body of the program. Each statement in C/C++ ends with a semicolon (;). C/C++ is a case sensitive language. The C/C++ statements are normally written in lowercase letters but in some exceptional cases, these can also be written in uppercase. Keywords The words that are used by the language for special purposes are called keywords. These are also called reserved words. For example, in a C/C++ program, the word main is used to indicate the starting of program, int to declare an integer type variable etc. These keywords cannot be used as variable names in a program.