SlideShare une entreprise Scribd logo
1  sur  14
Programming Fundamentals
Lab No. 1
Introduction to C++ Basics
Structure of C++ Programs
A C++ program consists of three main parts.
• Preprocessor Directives
• The main Function
• C++ Statements
Preprocessor Directives
#include<iostream>
#include<conio.h> // .h shows that it’s a header file
Using namespace std;
Main Function
Int main()
{
}
C++ Statements
• Cout<<“programming is fun”;
• Cin>>name;
• Cout<<“Your name is <<name;
Sample Program
#include<iostream>
#include<conio.h>
Using namespace std;
Int main()
{
Cout<<“This is my first program”;
getch(); // if getch() is not used then display window will exit without
//waiting for a character to be pressed from the keyboard.
}
Predefined Identifiers
• Cout
Syntax:
Cout<<“……..”;
• Cin
Syntax
Cin>>…..;
Lets practice!
Initialization & Declaration
• Int x=4;
• int y=2;
• Int z=40;
• Int z; //declaration
• z=40; //initialization
• Int x=4, y=2, z=40;
Sample Program
To find the sum of two numbers
#include<iostream>
#include<conio.h> // .h extension is used to show that it’s a header file
Using namespace std;
Int main()
{
Int x=5;
Int y=3; //can also be written as int x=5, y=3;
Int z;
z=x+y; // No need to write ‘int’ with z again!!
Cout<<“z”<<endl;
Cout<<z; //Note that commas (“ “) are not used here. Make sure you know what difference it will make!
_getch();
}
Practice programs to get used to with C++ environment!

Contenu connexe

Tendances

Cd practical file (1) start se
Cd practical file (1) start seCd practical file (1) start se
Cd practical file (1) start sedalipkumar64
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With PythonSiddhi
 
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modulesPython Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modulesP3 InfoTech Solutions Pvt. Ltd.
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical fileAnkit Dixit
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th StudyChris Ohk
 
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
 
Python Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M18 - Modules and PackagesPython Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M18 - Modules and PackagesP3 InfoTech Solutions Pvt. Ltd.
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Timo Stollenwerk
 
Python Unit Test
Python Unit TestPython Unit Test
Python Unit TestDavid Xie
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c programNishmaNJ
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with pythonroskakori
 

Tendances (20)

basic program
basic programbasic program
basic program
 
Cd practical file (1) start se
Cd practical file (1) start seCd practical file (1) start se
Cd practical file (1) start se
 
Test Driven Development With Python
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With Python
 
F# Eye 4 the C# Guy
F# Eye 4 the C# GuyF# Eye 4 the C# Guy
F# Eye 4 the C# Guy
 
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modulesPython Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modules
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
System programmin practical file
System programmin practical fileSystem programmin practical file
System programmin practical file
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 
C structure
C structureC structure
C structure
 
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 !
 
System programs in C language.
System programs in C language.System programs in C language.
System programs in C language.
 
L8 file
L8 fileL8 file
L8 file
 
Python Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M18 - Modules and PackagesPython Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M18 - Modules and Packages
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
 
Python Unit Test
Python Unit TestPython Unit Test
Python Unit Test
 
1 introduction to c program
1 introduction to c program1 introduction to c program
1 introduction to c program
 
Pyunit
PyunitPyunit
Pyunit
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with python
 
Common Programming Errors
Common Programming ErrorsCommon Programming Errors
Common Programming Errors
 
Python Programming Essentials - M31 - PEP 8
Python Programming Essentials - M31 - PEP 8Python Programming Essentials - M31 - PEP 8
Python Programming Essentials - M31 - PEP 8
 

En vedette

Anatomy of a key account manager
Anatomy of a key account managerAnatomy of a key account manager
Anatomy of a key account managerGaudio Max
 
Why you should quit smoking
Why you should quit smokingWhy you should quit smoking
Why you should quit smokingDanial Sohail
 
Practicing oil analysis it's all about size
Practicing oil analysis   it's all about sizePracticing oil analysis   it's all about size
Practicing oil analysis it's all about sizefiltermag
 
Two to four wheeler transformable bike
Two to four wheeler transformable bikeTwo to four wheeler transformable bike
Two to four wheeler transformable bikeDanial Sohail
 
Blood Pressure - The risk factors
Blood Pressure - The risk factorsBlood Pressure - The risk factors
Blood Pressure - The risk factorsPINAKI ROY
 
Little book of leadership ppt
Little book of leadership pptLittle book of leadership ppt
Little book of leadership pptPINAKI ROY
 
Fm industrial data summary 2012
Fm industrial data summary 2012Fm industrial data summary 2012
Fm industrial data summary 2012filtermag
 
Sae paper 881825
Sae paper 881825Sae paper 881825
Sae paper 881825filtermag
 
Les metamorphose1
Les metamorphose1Les metamorphose1
Les metamorphose1PINAKI ROY
 
BP risk factors
BP risk factorsBP risk factors
BP risk factorsPINAKI ROY
 
microprocessor Lec 02 mic
microprocessor Lec 02 micmicroprocessor Lec 02 mic
microprocessor Lec 02 miciqbal ahmad
 
microprocessor Lec 01 mic
microprocessor Lec 01 micmicroprocessor Lec 01 mic
microprocessor Lec 01 miciqbal ahmad
 
Survey of NED Auditorium Ground
Survey of NED Auditorium GroundSurvey of NED Auditorium Ground
Survey of NED Auditorium GroundDanial Sohail
 
Tribology - The WDA Factor
Tribology - The WDA FactorTribology - The WDA Factor
Tribology - The WDA FactorPINAKI ROY
 
hybrid vehicles
 hybrid vehicles hybrid vehicles
hybrid vehiclesWaqas Ahmed
 

En vedette (18)

Anatomy of a key account manager
Anatomy of a key account managerAnatomy of a key account manager
Anatomy of a key account manager
 
Why you should quit smoking
Why you should quit smokingWhy you should quit smoking
Why you should quit smoking
 
Practicing oil analysis it's all about size
Practicing oil analysis   it's all about sizePracticing oil analysis   it's all about size
Practicing oil analysis it's all about size
 
Two to four wheeler transformable bike
Two to four wheeler transformable bikeTwo to four wheeler transformable bike
Two to four wheeler transformable bike
 
Blood Pressure - The risk factors
Blood Pressure - The risk factorsBlood Pressure - The risk factors
Blood Pressure - The risk factors
 
Little book of leadership ppt
Little book of leadership pptLittle book of leadership ppt
Little book of leadership ppt
 
boiler
boilerboiler
boiler
 
Fm industrial data summary 2012
Fm industrial data summary 2012Fm industrial data summary 2012
Fm industrial data summary 2012
 
Sae paper 881825
Sae paper 881825Sae paper 881825
Sae paper 881825
 
Les metamorphose1
Les metamorphose1Les metamorphose1
Les metamorphose1
 
BP risk factors
BP risk factorsBP risk factors
BP risk factors
 
Numbers
NumbersNumbers
Numbers
 
microprocessor Lec 02 mic
microprocessor Lec 02 micmicroprocessor Lec 02 mic
microprocessor Lec 02 mic
 
microprocessor Lec 01 mic
microprocessor Lec 01 micmicroprocessor Lec 01 mic
microprocessor Lec 01 mic
 
Survey of NED Auditorium Ground
Survey of NED Auditorium GroundSurvey of NED Auditorium Ground
Survey of NED Auditorium Ground
 
Tribology - The WDA Factor
Tribology - The WDA FactorTribology - The WDA Factor
Tribology - The WDA Factor
 
hybrid vehicles
 hybrid vehicles hybrid vehicles
hybrid vehicles
 
Nmlc ef3 module 1
Nmlc ef3 module 1Nmlc ef3 module 1
Nmlc ef3 module 1
 

Similaire à Programming lab 1 lecture

Similaire à Programming lab 1 lecture (20)

OOPS using C++
OOPS using C++OOPS using C++
OOPS using C++
 
Programming using c++ tool
Programming using c++ toolProgramming using c++ tool
Programming using c++ tool
 
C++Basics.pdf
C++Basics.pdfC++Basics.pdf
C++Basics.pdf
 
Fp201 unit2 1
Fp201 unit2 1Fp201 unit2 1
Fp201 unit2 1
 
What is c++ programming
What is c++ programmingWhat is c++ programming
What is c++ programming
 
C Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.comC Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.com
 
Introduction to c language by nitesh
Introduction to c language by niteshIntroduction to c language by nitesh
Introduction to c language by nitesh
 
C++ Chapter 3
C++ Chapter 3C++ Chapter 3
C++ Chapter 3
 
Introduction to C++,Computer Science
Introduction to C++,Computer ScienceIntroduction to C++,Computer Science
Introduction to C++,Computer Science
 
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)
 
Prog1-L1.pdf
Prog1-L1.pdfProg1-L1.pdf
Prog1-L1.pdf
 
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
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
C++
C++C++
C++
 
l1-introduction_to_computers_and_c_programming.pptx
l1-introduction_to_computers_and_c_programming.pptxl1-introduction_to_computers_and_c_programming.pptx
l1-introduction_to_computers_and_c_programming.pptx
 
1 introducing c language
1  introducing c language1  introducing c language
1 introducing c language
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
C++ programming
C++ programmingC++ programming
C++ programming
 
C++ Constructs.pptx
C++ Constructs.pptxC++ Constructs.pptx
C++ Constructs.pptx
 

Plus de iqbal ahmad

Probability, random variables and random signal principles 2nd ed. p. peebles
Probability, random variables and random signal principles 2nd ed.   p. peeblesProbability, random variables and random signal principles 2nd ed.   p. peebles
Probability, random variables and random signal principles 2nd ed. p. peeblesiqbal ahmad
 
signal and system Lecture 3
signal and system Lecture 3signal and system Lecture 3
signal and system Lecture 3iqbal ahmad
 
signal and system Lecture 2
signal and system Lecture 2signal and system Lecture 2
signal and system Lecture 2iqbal ahmad
 
signal and system Lecture 1
signal and system Lecture 1signal and system Lecture 1
signal and system Lecture 1iqbal ahmad
 
signal and system Dirac delta functions (1)
signal and system Dirac delta functions (1)signal and system Dirac delta functions (1)
signal and system Dirac delta functions (1)iqbal ahmad
 
signal and system solution Quiz2
signal and system solution Quiz2signal and system solution Quiz2
signal and system solution Quiz2iqbal ahmad
 
signal and system Hw2 solution
signal and system Hw2 solutionsignal and system Hw2 solution
signal and system Hw2 solutioniqbal ahmad
 
Capacitors and inductors
Capacitors and inductorsCapacitors and inductors
Capacitors and inductorsiqbal ahmad
 
Second order ena notes
Second order ena notesSecond order ena notes
Second order ena notesiqbal ahmad
 
First order ena notes
First order ena notesFirst order ena notes
First order ena notesiqbal ahmad
 

Plus de iqbal ahmad (11)

Probability, random variables and random signal principles 2nd ed. p. peebles
Probability, random variables and random signal principles 2nd ed.   p. peeblesProbability, random variables and random signal principles 2nd ed.   p. peebles
Probability, random variables and random signal principles 2nd ed. p. peebles
 
signal and system Lecture 3
signal and system Lecture 3signal and system Lecture 3
signal and system Lecture 3
 
signal and system Lecture 2
signal and system Lecture 2signal and system Lecture 2
signal and system Lecture 2
 
signal and system Lecture 1
signal and system Lecture 1signal and system Lecture 1
signal and system Lecture 1
 
signal and system Dirac delta functions (1)
signal and system Dirac delta functions (1)signal and system Dirac delta functions (1)
signal and system Dirac delta functions (1)
 
signal and system solution Quiz2
signal and system solution Quiz2signal and system solution Quiz2
signal and system solution Quiz2
 
Hw1 solution
Hw1 solutionHw1 solution
Hw1 solution
 
signal and system Hw2 solution
signal and system Hw2 solutionsignal and system Hw2 solution
signal and system Hw2 solution
 
Capacitors and inductors
Capacitors and inductorsCapacitors and inductors
Capacitors and inductors
 
Second order ena notes
Second order ena notesSecond order ena notes
Second order ena notes
 
First order ena notes
First order ena notesFirst order ena notes
First order ena notes
 

Dernier

Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 

Dernier (20)

Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 

Programming lab 1 lecture