SlideShare ist ein Scribd-Unternehmen logo
1 von 18
INTRODUCTION TO
PROGRAMMING
WHAT IS A PROGRAM?
‱ A program is a set of instructions in a programming
language given to a computer to perform some useful
task.
WHY DO WE NEED TO LEARN A
PROGRAMMING LANGUAGE?
‱ A computer is just a machine. It cannot do anything till it is told
to do so. Like a fan for example will not start until we switch it
on.
‱ So in order to be able to make it work we need to give it specific
instructions.
INSTRUCTING THE
COMPUTER IN SIMPLE
LANGUAGE
‱ It will not understand.
We have to
communicate with
this machine in the
language it
understands.
Add the numbers 4 and 5
WHAT IS HIGH LEVEL LANGUAGE?
‱ The computer understands only binary language or machine language
which contains only two digits, 0 and 1.
‱ These are 0 (means off) and 1 (means on).
‱ It is humanly impossible to communicate all the commands or
instructions using only these two numbers.
‱ So high level languages were created. Such languages are
considered high-level because they are closer to human languages and
further from machine languages.
C++ PROGRAMMING LANGUAGE
C++ is a high level
programming
language
01
It was created by
Bjarne Stroustrup.
02
It is a versatile,
powerful object
oriented language
03
THE FIRST C++
PROGRAM
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
THE PREPROCESSOR
DIRECTIVE
#include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
The symbol # is
the Preprocessor
Directive
A preprocessor
directive is a direct
command to the
compiler
To perform an action
Preprocessor
Directive
THE INCLUDE
KEYWORD
#include<iostream.h>
void main( )
{
cout<< “Hello World”;
}
The include keyword
gives a command to
include a file, in this
case a header file,
iostream.h
THE IOSTREAM.H
HEADER FILE
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
The iostream .h header
file stands for Input
Output stream file
which contains
commands and
instructions necessary
to connect our
program to the input
and output streams.
A header file is a file
with
extension .h which
contains C++ function
declarations and
THE MAIN()
FUNCTION
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
Every c++ program
must have a main()
function as the
execution begins here.
In fact main() is the
only self executing
function in c++.
Since it is a function it
must contain a pair of
brackets and must be
preceded by a return
type, void , in this case.
THE MAIN() BODY :
BRACES
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
The body of main()
consists of executable
statements within a
pair of curly braces. { }
Whatever is written in
these braces is the
code that is executed
when the program is
run.
THE COUT
STATEMENT
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
In this case the main()
function consists of a
single executable
statement;
cout<< “Hello World”;
cout stands for
console output. It is
actually a command to
display something on
the output console;
the screen in this case.
THE INSERTION(<<)
OPERATORS.
# include <iostream.h>
void main( )
{
cout << “Hello World”;
}
cout<< “Hello World”;
The << symbol are
known as insertion
operators. They are
used to direct the
output to the console
in this case.
THE STRING IN
DOUBLE QUOTES” ”
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
“Hello World ” is a
constant string. It is
displayed as a
message on the
screen. Any text or
number or symbol
written within a pair of
“ ” apostrophes is
displayed as it is on
the screen.
THE STATEMENT
TERMINATOR(;)
# include <iostream.h>
void main( )
{
cout<< “Hello World” ;
}
The semicolon ; is a
statement terminator
in c++. It is used at the
end of various
executable statements
and declarations to
mark the end of a
statement.
C++ source code
# include <iostream.h>
void main( )
{
cout<< “Hello World”;
}
Hello World
Output
THE EXECUTION OF THE FIRST
PROGRAM
HOW THE C++ PROGRAM
IS EXECUTED
Executable code(running the program)
First.exe
Machine language code(compiler)
First.obj
Source code( Create on Editor)
First.cpp
The c++ source code is written on the c++ editor. When
it is saved a file with the extension .cpp is generated
It is then compiled, wherein the compiler converts the
high level program to machine language. A file with the
extension .obj is generated
The machine code is then executed to generate an
executable file. A file with extension .exe is executed.
NOTE : the process of compilation also generates syntax
errors if any.

Weitere Àhnliche Inhalte

Was ist angesagt?

Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
Varun Garg
 
Computer programming concepts
Computer programming conceptsComputer programming concepts
Computer programming concepts
Jasper John Cinatad
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
NSU-Biliran Campus
 

Was ist angesagt? (20)

Types of Programming Languages
Types of Programming LanguagesTypes of Programming Languages
Types of Programming Languages
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
 
Boolean+logic
Boolean+logicBoolean+logic
Boolean+logic
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Introduction to basic programming
Introduction to basic programmingIntroduction to basic programming
Introduction to basic programming
 
Introduction to Coding
Introduction to CodingIntroduction to Coding
Introduction to Coding
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Introduction to programming languages
Introduction to programming languagesIntroduction to programming languages
Introduction to programming languages
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
 
Programming Fundamentals
Programming FundamentalsProgramming Fundamentals
Programming Fundamentals
 
Compilers
CompilersCompilers
Compilers
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Lect 1. introduction to programming languages
Lect 1. introduction to programming languagesLect 1. introduction to programming languages
Lect 1. introduction to programming languages
 
Programming paradigm
Programming paradigmProgramming paradigm
Programming paradigm
 
Introduction to Operating Systems
Introduction to Operating SystemsIntroduction to Operating Systems
Introduction to Operating Systems
 
Computer programming concepts
Computer programming conceptsComputer programming concepts
Computer programming concepts
 
Python
PythonPython
Python
 
Computer languages
Computer languagesComputer languages
Computer languages
 
Introduction to computer programming
Introduction to computer programmingIntroduction to computer programming
Introduction to computer programming
 

Ähnlich wie Introduction to programming

Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
rohassanie
 

Ähnlich wie Introduction to programming (20)

Introduction
IntroductionIntroduction
Introduction
 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
IITK ESC 111M Lec02.pptx .
IITK ESC 111M Lec02.pptx               .IITK ESC 111M Lec02.pptx               .
IITK ESC 111M Lec02.pptx .
 
Theory of programming
Theory of programmingTheory of programming
Theory of programming
 
Programming Fundamentals lecture 5
Programming Fundamentals lecture 5Programming Fundamentals lecture 5
Programming Fundamentals lecture 5
 
BIS07 Application Development - I
BIS07 Application Development - IBIS07 Application Development - I
BIS07 Application Development - I
 
C++ basics
C++ basicsC++ basics
C++ basics
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
General structure of c++
General structure of c++General structure of c++
General structure of c++
 
Introduction to c language by nitesh
Introduction to c language by niteshIntroduction to c language by nitesh
Introduction to c language by nitesh
 
basic program
basic programbasic program
basic program
 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language
 
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
 
OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
 
Intro To C++ - Class 3 - Sample Program
Intro To C++ - Class 3 - Sample ProgramIntro To C++ - Class 3 - Sample Program
Intro To C++ - Class 3 - Sample Program
 
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part II
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part IIIntro To C++ - Class 03 - An Introduction To C++ Programming, Part II
Intro To C++ - Class 03 - An Introduction To C++ Programming, Part II
 
C programming ii
C programming   iiC programming   ii
C programming ii
 

Mehr von Neeru Mittal

Mehr von Neeru Mittal (18)

Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Introduction to AI and its domains.pptx
Introduction to AI and its domains.pptxIntroduction to AI and its domains.pptx
Introduction to AI and its domains.pptx
 
Brain Storming techniques in Python
Brain Storming techniques in PythonBrain Storming techniques in Python
Brain Storming techniques in Python
 
Data Analysis with Python Pandas
Data Analysis with Python PandasData Analysis with Python Pandas
Data Analysis with Python Pandas
 
Python Tips and Tricks
Python Tips and TricksPython Tips and Tricks
Python Tips and Tricks
 
Python and CSV Connectivity
Python and CSV ConnectivityPython and CSV Connectivity
Python and CSV Connectivity
 
Working of while loop
Working of while loopWorking of while loop
Working of while loop
 
Increment and Decrement operators in C++
Increment and Decrement operators in C++Increment and Decrement operators in C++
Increment and Decrement operators in C++
 
Library functions in c++
Library functions in c++Library functions in c++
Library functions in c++
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
 
Arrays
ArraysArrays
Arrays
 
Nested loops
Nested loopsNested loops
Nested loops
 
Iterative control structures, looping, types of loops, loop working
Iterative control structures, looping, types of loops, loop workingIterative control structures, looping, types of loops, loop working
Iterative control structures, looping, types of loops, loop working
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
Operators and expressions in C++
Operators and expressions in C++Operators and expressions in C++
Operators and expressions in C++
 
Getting started in c++
Getting started in c++Getting started in c++
Getting started in c++
 
Introduction to Selection control structures in C++
Introduction to Selection control structures in C++ Introduction to Selection control structures in C++
Introduction to Selection control structures in C++
 

KĂŒrzlich hochgeladen

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

KĂŒrzlich hochgeladen (20)

Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
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)
 
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.
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
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
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
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
 
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
TỔNG ÔN TáșŹP THI VÀO LỚP 10 MÔN TIáșŸNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGở Â...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Introduction to programming

  • 2. WHAT IS A PROGRAM? ‱ A program is a set of instructions in a programming language given to a computer to perform some useful task.
  • 3. WHY DO WE NEED TO LEARN A PROGRAMMING LANGUAGE? ‱ A computer is just a machine. It cannot do anything till it is told to do so. Like a fan for example will not start until we switch it on. ‱ So in order to be able to make it work we need to give it specific instructions.
  • 4. INSTRUCTING THE COMPUTER IN SIMPLE LANGUAGE ‱ It will not understand. We have to communicate with this machine in the language it understands. Add the numbers 4 and 5
  • 5. WHAT IS HIGH LEVEL LANGUAGE? ‱ The computer understands only binary language or machine language which contains only two digits, 0 and 1. ‱ These are 0 (means off) and 1 (means on). ‱ It is humanly impossible to communicate all the commands or instructions using only these two numbers. ‱ So high level languages were created. Such languages are considered high-level because they are closer to human languages and further from machine languages.
  • 6. C++ PROGRAMMING LANGUAGE C++ is a high level programming language 01 It was created by Bjarne Stroustrup. 02 It is a versatile, powerful object oriented language 03
  • 7. THE FIRST C++ PROGRAM # include <iostream.h> void main( ) { cout<< “Hello World”; }
  • 8. THE PREPROCESSOR DIRECTIVE #include <iostream.h> void main( ) { cout<< “Hello World”; } The symbol # is the Preprocessor Directive A preprocessor directive is a direct command to the compiler To perform an action Preprocessor Directive
  • 9. THE INCLUDE KEYWORD #include<iostream.h> void main( ) { cout<< “Hello World”; } The include keyword gives a command to include a file, in this case a header file, iostream.h
  • 10. THE IOSTREAM.H HEADER FILE # include <iostream.h> void main( ) { cout<< “Hello World”; } The iostream .h header file stands for Input Output stream file which contains commands and instructions necessary to connect our program to the input and output streams. A header file is a file with extension .h which contains C++ function declarations and
  • 11. THE MAIN() FUNCTION # include <iostream.h> void main( ) { cout<< “Hello World”; } Every c++ program must have a main() function as the execution begins here. In fact main() is the only self executing function in c++. Since it is a function it must contain a pair of brackets and must be preceded by a return type, void , in this case.
  • 12. THE MAIN() BODY : BRACES # include <iostream.h> void main( ) { cout<< “Hello World”; } The body of main() consists of executable statements within a pair of curly braces. { } Whatever is written in these braces is the code that is executed when the program is run.
  • 13. THE COUT STATEMENT # include <iostream.h> void main( ) { cout<< “Hello World”; } In this case the main() function consists of a single executable statement; cout<< “Hello World”; cout stands for console output. It is actually a command to display something on the output console; the screen in this case.
  • 14. THE INSERTION(<<) OPERATORS. # include <iostream.h> void main( ) { cout << “Hello World”; } cout<< “Hello World”; The << symbol are known as insertion operators. They are used to direct the output to the console in this case.
  • 15. THE STRING IN DOUBLE QUOTES” ” # include <iostream.h> void main( ) { cout<< “Hello World”; } “Hello World ” is a constant string. It is displayed as a message on the screen. Any text or number or symbol written within a pair of “ ” apostrophes is displayed as it is on the screen.
  • 16. THE STATEMENT TERMINATOR(;) # include <iostream.h> void main( ) { cout<< “Hello World” ; } The semicolon ; is a statement terminator in c++. It is used at the end of various executable statements and declarations to mark the end of a statement.
  • 17. C++ source code # include <iostream.h> void main( ) { cout<< “Hello World”; } Hello World Output THE EXECUTION OF THE FIRST PROGRAM
  • 18. HOW THE C++ PROGRAM IS EXECUTED Executable code(running the program) First.exe Machine language code(compiler) First.obj Source code( Create on Editor) First.cpp The c++ source code is written on the c++ editor. When it is saved a file with the extension .cpp is generated It is then compiled, wherein the compiler converts the high level program to machine language. A file with the extension .obj is generated The machine code is then executed to generate an executable file. A file with extension .exe is executed. NOTE : the process of compilation also generates syntax errors if any.