SlideShare a Scribd company logo
1 of 14
2. Beginning with C++
WHAT IS C++?
C++ is an object-oriented programming language wnd as
developed by Bjarne Stroustrup at AT&T Bell Laboratories
in Murray Hill, New Jersey, USA, in the early 1980’s.
C++ is an extension of C with a major addition of the class
construct feature of Simula67. In 1983, the name was
changed to C++ suggesting that C++ is an augmented
(incremented) version of C.
The most important facilities that C++ adds on to C are
classes, inheritance, function overloading, and operator
overloading.
• These features enable creation of abstract data types, inherit
properties from existing data types and support polymorphism.
APPLICATIONS OF C++
C++ is a versatile language for handling very large
programs.
• Since C++ allows us to create hierarchy-related objects, we can
build special object-oriented libraries which can be used later
by many programmers.
• C++ is able to map the real-world problem properly, the C part
of C++ gives the language the ability to get close to the
machine-level details.
• C++ programs are easily maintainable and expandable. When
a new feature needs to be implemented, it is very easy to add
to the existing structure of an object.
A SIMPLE C++ PROGRAM
A program that prints a string on the screen :
#include <iostream> // include header file
using namespace std;
int main()
{
cout << “C++ is better than C.n”; // C++ statement
return 0;
} // End of example
… Program Features
C++ program is a collection of functions – the example
contains only one function, main() and the execution
begins when encountered with this function.
The compiler ignores carriage returns and white spaces.
The C++ statements terminate with semicolons
… Comments
Comments start with a double slash symbol and terminate
at the end of the line.
The // comment is basically a single line comment.
/*, */ are more suitable for multiline comments.
/* This is an example of
C++ program to illustrate
some of its features
*/
… Output Operator
The statement
cout << “C++ is better than C.”;
causes the string in quotation marks to be displayed on the
screen.
• The identifier cout (pronounced as ‘C out’) is a predefined
object that represents the standard output stream in C++.
• The operator << is called the insertion or put to operator. It
inserts (or sends) the contents of the variable on its right to the
object on its left
… The iostream File
All C++ programs begin with a #include directive that
includes the specified header file contents into the main
program.
The program has used the following #include directive in
the program:
#include <iostream>
This directive causes the preprocessor to add the contents
of the iostream file to the program.
• It contains declarations for the identifier cout and the operator <<.
The header file iostream should be included at the
beginning of all programs that use input/output statements.
• Some implementations use iostream.hpp; yet others iostream.hxx.
... Namespace
Namespace, a new concept, is defined a scope for the
identifiers that are used in a program.
For using the identifiers defined in the namespace scope,
we must include the using directive, like
using namespace std;
std is the namespace where ANSI C++ standard class libraries are
defined.
using and namespace are the new keywords of C++.
…Return Type of main( )
In C++, main() returns an integer type value to the
operating system. Therefore, every main() in C++ should
end with a return(0) statement.
The following main without type and return will run with a
warning:
int main()
{
......
...... return 0
}
10
Update Footer Text in Insert Tab's Header & Footer
MORE C++ STATEMENTS
Variables :
All variables must be declared before they are used in the
program
Input Operator :
The operator >> is known as extraction or get from
operator - It extracts (or takes) the value from the keyboard
and assigns it to the variable on its right
Cascading of I/O Operators :
The multiple use of << or >> in one statement is called
cascading. When cascading an output operator, we should
ensure necessary blank spaces between different items.
STRUCTURE OF C++ PROGRAM
A typical C++ program would contain four sections - these
sections may be placed in separate code files and then
compiled independently or jointly.
It is a common practice to organize a program into three
separate files (client-server model).
• The class declarations are placed in a header file
• The definitions of member functions go into the second file.
• the main program that uses the class is placed in a third file
which ‘includes’ the previous two files as well as any other files
required.
Include files
Class declaration
Member functions definitions
Main function program
CREATING THE SOURCE FILE
C++ programs can be created using any text editor.
• On the UNIX, vi or ed text editor for creating and editing the
source code can be used.
• On the DOS system, edlin or any other editor available or a
word processor system under non-document mode can be
used.
Some systems such as Turbo C++ provide an integrated
environment for developing and editing programs.
COMPILING AND LINKING
The process of compiling and linking again depends upon
the operating system. A few popular systems are :
Unix AT&T C++ Turbo C++ and Borland C++ Visual C++
The “CC” (uppercase)
command is used to compile
a program. The default
executable filename is a.out.
When a file needs to be
modified, it has to be first
compiled. The files that are
not modified need not be
compiled again.
Turbo C++ and Borland C++
provide a built-in editor and a
menu bar which includes
options such as File, Edit,
Compile and Run -
We can create and save the
source files under the File
option and edit them under
the Edit option. We can then
compile the program under
the Compile option and
execute it under the Run
option.
Visual C++ is a visual
programming
environment in which
basic program
components can be
selected through menu
choices, buttons, icons,
and other predetermined
methods.

More Related Content

Similar to Introduction to cpp language and all the required information relating to it

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].pptxCoolGamer16
 
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...bhargavi804095
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docMayurWagh46
 
C++ language basic
C++ language basicC++ language basic
C++ language basicWaqar Younis
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionAKR Education
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c languagefarishah
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptxDineshDhuri4
 
PRINCE PRESENTATION(1).pptx
PRINCE PRESENTATION(1).pptxPRINCE PRESENTATION(1).pptx
PRINCE PRESENTATION(1).pptxSajalKesharwani2
 
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)Shujaat Abbas
 

Similar to Introduction to cpp language and all the required information relating to it (20)

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++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
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...
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
C++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWAREC++ AND CATEGORIES OF SOFTWARE
C++ AND CATEGORIES OF SOFTWARE
 
Lab 1.pptx
Lab 1.pptxLab 1.pptx
Lab 1.pptx
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
Workshop1
Workshop1Workshop1
Workshop1
 
Chap 2 c++
Chap 2 c++Chap 2 c++
Chap 2 c++
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
Basics Of C++.pptx
Basics Of C++.pptxBasics Of C++.pptx
Basics Of C++.pptx
 
PRINCE PRESENTATION(1).pptx
PRINCE PRESENTATION(1).pptxPRINCE PRESENTATION(1).pptx
PRINCE PRESENTATION(1).pptx
 
Cp week _2.
Cp week _2.Cp week _2.
Cp week _2.
 
C++ How to program
C++ How to programC++ How to program
C++ How to program
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
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)
 

Recently uploaded

8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
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
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
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
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 

Recently uploaded (20)

8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
🔝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...
 
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
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
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
 
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
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 

Introduction to cpp language and all the required information relating to it

  • 2. WHAT IS C++? C++ is an object-oriented programming language wnd as developed by Bjarne Stroustrup at AT&T Bell Laboratories in Murray Hill, New Jersey, USA, in the early 1980’s. C++ is an extension of C with a major addition of the class construct feature of Simula67. In 1983, the name was changed to C++ suggesting that C++ is an augmented (incremented) version of C. The most important facilities that C++ adds on to C are classes, inheritance, function overloading, and operator overloading. • These features enable creation of abstract data types, inherit properties from existing data types and support polymorphism.
  • 3. APPLICATIONS OF C++ C++ is a versatile language for handling very large programs. • Since C++ allows us to create hierarchy-related objects, we can build special object-oriented libraries which can be used later by many programmers. • C++ is able to map the real-world problem properly, the C part of C++ gives the language the ability to get close to the machine-level details. • C++ programs are easily maintainable and expandable. When a new feature needs to be implemented, it is very easy to add to the existing structure of an object.
  • 4. A SIMPLE C++ PROGRAM A program that prints a string on the screen : #include <iostream> // include header file using namespace std; int main() { cout << “C++ is better than C.n”; // C++ statement return 0; } // End of example
  • 5. … Program Features C++ program is a collection of functions – the example contains only one function, main() and the execution begins when encountered with this function. The compiler ignores carriage returns and white spaces. The C++ statements terminate with semicolons
  • 6. … Comments Comments start with a double slash symbol and terminate at the end of the line. The // comment is basically a single line comment. /*, */ are more suitable for multiline comments. /* This is an example of C++ program to illustrate some of its features */
  • 7. … Output Operator The statement cout << “C++ is better than C.”; causes the string in quotation marks to be displayed on the screen. • The identifier cout (pronounced as ‘C out’) is a predefined object that represents the standard output stream in C++. • The operator << is called the insertion or put to operator. It inserts (or sends) the contents of the variable on its right to the object on its left
  • 8. … The iostream File All C++ programs begin with a #include directive that includes the specified header file contents into the main program. The program has used the following #include directive in the program: #include <iostream> This directive causes the preprocessor to add the contents of the iostream file to the program. • It contains declarations for the identifier cout and the operator <<. The header file iostream should be included at the beginning of all programs that use input/output statements. • Some implementations use iostream.hpp; yet others iostream.hxx.
  • 9. ... Namespace Namespace, a new concept, is defined a scope for the identifiers that are used in a program. For using the identifiers defined in the namespace scope, we must include the using directive, like using namespace std; std is the namespace where ANSI C++ standard class libraries are defined. using and namespace are the new keywords of C++.
  • 10. …Return Type of main( ) In C++, main() returns an integer type value to the operating system. Therefore, every main() in C++ should end with a return(0) statement. The following main without type and return will run with a warning: int main() { ...... ...... return 0 } 10 Update Footer Text in Insert Tab's Header & Footer
  • 11. MORE C++ STATEMENTS Variables : All variables must be declared before they are used in the program Input Operator : The operator >> is known as extraction or get from operator - It extracts (or takes) the value from the keyboard and assigns it to the variable on its right Cascading of I/O Operators : The multiple use of << or >> in one statement is called cascading. When cascading an output operator, we should ensure necessary blank spaces between different items.
  • 12. STRUCTURE OF C++ PROGRAM A typical C++ program would contain four sections - these sections may be placed in separate code files and then compiled independently or jointly. It is a common practice to organize a program into three separate files (client-server model). • The class declarations are placed in a header file • The definitions of member functions go into the second file. • the main program that uses the class is placed in a third file which ‘includes’ the previous two files as well as any other files required. Include files Class declaration Member functions definitions Main function program
  • 13. CREATING THE SOURCE FILE C++ programs can be created using any text editor. • On the UNIX, vi or ed text editor for creating and editing the source code can be used. • On the DOS system, edlin or any other editor available or a word processor system under non-document mode can be used. Some systems such as Turbo C++ provide an integrated environment for developing and editing programs.
  • 14. COMPILING AND LINKING The process of compiling and linking again depends upon the operating system. A few popular systems are : Unix AT&T C++ Turbo C++ and Borland C++ Visual C++ The “CC” (uppercase) command is used to compile a program. The default executable filename is a.out. When a file needs to be modified, it has to be first compiled. The files that are not modified need not be compiled again. Turbo C++ and Borland C++ provide a built-in editor and a menu bar which includes options such as File, Edit, Compile and Run - We can create and save the source files under the File option and edit them under the Edit option. We can then compile the program under the Compile option and execute it under the Run option. Visual C++ is a visual programming environment in which basic program components can be selected through menu choices, buttons, icons, and other predetermined methods.