Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
C++ Language 
By:-AAKASH KAUSHIK 
#9289817971, 98919893083 
Email-theaakashkumar@gmail.com
UNIT -2 
BASIC STRUCTURE OF 
A C++ PROGRAM
BASIC STRUCTURE OF A C++ 
PROGRAM 
#include<iostream.h> 
#include<conio.h> 
void main() 
{ 
clrscr(); 
Program code will b...
#include<iostream.h> 
# 
# is called Preprocessor directive 
Preprocessing 
Preprocessing is the phase of compilation befo...
#include<iostream.h> 
#include<conio.h> 
These are the header file inclusion statement 
Header Files 
Header files are the...
void main() 
This is the main() method/ function of a C++ 
program. Actual execution of a program starts 
from main method...
FIRST C++ PROGRAM 
#include<iostream.h> 
#include<conio.h> 
void main() 
{ 
clrscr(); 
cout<<“My First C++ Program”; 
getc...
iostream.h 
Iostream stands for Input Output Stream 
It contains functions related to input and output. 
For ex.- cout,cin...
conio.h 
conio stands for Console Input Output . 
It contains functions related to Console screen 
input and output. 
The ...
clrscr(); 
Function defined within conio.h file 
It clears the previous output screen. 
AAKASH KAUSHIK 
9891983083,9289817...
cout<<“ text to be display”; 
Defined within iostream.h 
The text written within double quotes(“ ”) will got 
displayed on...
getch(); 
Function defined within conio.h file 
It holds the final output screen until any 
key is pressed by user. 
AAKAS...
RULES OF C++ LANGUAGE 
 Every program should have main() 
 Every statement should be end with 
semicolon(;) 
 This Lang...
Escape sequences 
n – New Line 
t - Horizontal Tab 
a - beep 
// - / 
/’ - ’ 
/” - ” 
0 –Null 
AAKASH KAUSHIK 
9891983083,...
Comments in a C++ Program 
Comments are used to increase 
understandability and readability of a 
program. These comments ...
Type of Comments 
SINGLE LINE COMMENT 
Starts with // and treats all the contents 
following // as comments within that li...
COMMENTS USAGE EXAMPLE 
/* TITLE :- MY FIRST C++ PROGRAM 
CREATED BY :- XYZ 
*/ 
#include<iostream.h> 
#include<conio.h> 
...
THANK 
YOU 
AAKASH KAUSHIK 
9891983083,9289817971
Prochain SlideShare
Chargement dans…5
×

c++ programming Unit 2 basic structure of a c++ program

6 664 vues

Publié le

BASIC STRUCTURE OF A C++ PROGRAM
HEADER FILES
COUT
CLRSCR
GETCH
COMPILE A PROGRAM
EXECUTE A PROGRAM

Publié dans : Formation

c++ programming Unit 2 basic structure of a c++ program

  1. 1. C++ Language By:-AAKASH KAUSHIK #9289817971, 98919893083 Email-theaakashkumar@gmail.com
  2. 2. UNIT -2 BASIC STRUCTURE OF A C++ PROGRAM
  3. 3. BASIC STRUCTURE OF A C++ PROGRAM #include<iostream.h> #include<conio.h> void main() { clrscr(); Program code will be written here getch(); } AAKASH KAUSHIK 9891983083,9289817971
  4. 4. #include<iostream.h> # # is called Preprocessor directive Preprocessing Preprocessing is the phase of compilation before the actual execution. AAKASH KAUSHIK 9891983083,9289817971
  5. 5. #include<iostream.h> #include<conio.h> These are the header file inclusion statement Header Files Header files are the predefined files in the C++ library using which we create new program. AAKASH KAUSHIK 9891983083,9289817971
  6. 6. void main() This is the main() method/ function of a C++ program. Actual execution of a program starts from main method. AAKASH KAUSHIK 9891983083,9289817971
  7. 7. FIRST C++ PROGRAM #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<“My First C++ Program”; getch(); } TO COMPILE- Alt+F9 TO EXECUTE-Ctrl+F9 AAKASH KAUSHIK 9891983083,9289817971
  8. 8. iostream.h Iostream stands for Input Output Stream It contains functions related to input and output. For ex.- cout,cin etc. AAKASH KAUSHIK 9891983083,9289817971
  9. 9. conio.h conio stands for Console Input Output . It contains functions related to Console screen input and output. The output screen of C++ is called Console Screen. AAKASH KAUSHIK 9891983083,9289817971
  10. 10. clrscr(); Function defined within conio.h file It clears the previous output screen. AAKASH KAUSHIK 9891983083,9289817971
  11. 11. cout<<“ text to be display”; Defined within iostream.h The text written within double quotes(“ ”) will got displayed on the output screen as it is. AAKASH KAUSHIK 9891983083,9289817971
  12. 12. getch(); Function defined within conio.h file It holds the final output screen until any key is pressed by user. AAKASH KAUSHIK 9891983083,9289817971
  13. 13. RULES OF C++ LANGUAGE  Every program should have main()  Every statement should be end with semicolon(;)  This Language is case sensitive  All the letter should be in lowercase. AAKASH KAUSHIK 9891983083,9289817971
  14. 14. Escape sequences n – New Line t - Horizontal Tab a - beep // - / /’ - ’ /” - ” 0 –Null AAKASH KAUSHIK 9891983083,9289817971
  15. 15. Comments in a C++ Program Comments are used to increase understandability and readability of a program. These comments will be ignored by the compiler at the time of compilation/execution. i.e, comments are part of a program but not the part of compiled/executed code. AAKASH KAUSHIK 9891983083,9289817971
  16. 16. Type of Comments SINGLE LINE COMMENT Starts with // and treats all the contents following // as comments within that line MULTIPLE LINE COMMENT Starts with /* and ends with */ and all the contents in between will be treated as comments AAKASH KAUSHIK 9891983083,9289817971
  17. 17. COMMENTS USAGE EXAMPLE /* TITLE :- MY FIRST C++ PROGRAM CREATED BY :- XYZ */ #include<iostream.h> #include<conio.h> void main() { clrscr(); // to clear the output screen cout<<“My First C++ Program”; getch(); //to pause the final output } AAKASH KAUSHIK 9891983083,9289817971
  18. 18. THANK YOU AAKASH KAUSHIK 9891983083,9289817971

×