How To Use C pulse pulse keywords With Examples

How To Use C pulse pulse keywords With Examples
How To Use C pulse keywords With Examples

How To Use Keywords List Data

Keywords: C++ keyword used as an identifier in  C++ programs, it is reserved keywords in C++ library and used to perform an internal operation.


List of C++ Keywords


 1.auto       

2.break    

3.case     

4.char

5.const     

6.continue       

7.default   

8.do

9.double    

10.else  

11.enum              

12.extern

13.float    

14.for      

15.goto             

16.if

17.int       

18.long    

19.register             

20.return

21.short    

22.signed              

23.sizeof           

24.static

25.struct  

26.switch       

27.typedef 

28.union

29.unsigned                

30.void    

31.volatile    

32.while

33.new               

34.this    

35.operator   

36.throw 

37.bool   

38.explicit   

39.private    

40.true

41.export   

42.protected     

43.try     

44.public  

45.catch     

46.false     

47.class     

48.friend    

49.default    

50. inline    

51.delete    

52.template 

53.namespace    

54.virtual  

55.Pointer


Example of All Keyword in C++ language in Full Details

auto

An auto keyword makes an automatic variable like:

auto int data;

This statement suggests that data is a variable of storage class auto and datatype int.

Automatic variables are local functions, they are also called local variables. so it is called the auto variable.

break

break keyword statement terminates the loop immediately. The break statement ends the for a loop when the condition is false.


Some Others Languages Keywords 

👉C Language Keywords

👉Java Language Keywords

👉Python Language Keywords 


How To Use break Statement in C++?

 #include<iostream>

using namespace std;

int main()

{

for(int i=1;i<=10;i++)

{

if(i==5)

{

cout<<"break the 5 value of break statement";

break;

}

cout<<i<<"\n;

}

}

*****OUTPUT*****

1

2

3

4

break the 5 value of break statement


continue Statement: A continue statement skips the value of the current iteration of the loop. continue statement is a print next iteration.

How To Use continue statement in C++?

 #include<iostream>

using namespace std;

int main()

{

for(int i=1;i<=10;i++)

{

if(i==5)

{

cout<<"skip the 5 value of continue statement";

continue;

}

cout<<i<<"\n;

}

}

*****OUTPUT*****

1

2

3

4

skip the 5 value of continue statement

6

7

8

9

10


Switch Case: A switch statement is used to check the condition. The switch statement is a very most useful statement. switch statements are a multiple condition check using a switch case.  


Syntax switch Statement 

  switch(expression)

{

    case '1':

    //case one execute ;

    break;

    case '3':

    //case three execute;

    break;

    default:

    //no case match is default case is executed;

}


How To Use switch statement in C++?

#include<iostream>

using namespace std;

int main()

{

int x=2;

switch(2)

{

               case 1:

                              cout<<"case one executed";

                              break;

               case 2:

                              cout<<"case two execuetd";

                              break;

               case 3:

                              cout<<"case three executed";

               default:

                              cout<<"value are not match";

               }

}

*****OUTPUT*****

case two executed 


char: A char keyword defines the character value

Example:

char grade='A';


HowTo Use of char keyword?

 #include<iostream>

using namespace std;

int main()

{

char grade='A';

cout<<"Student garde value:"<<grade;

}

*****OUTPUT*****

Student grade value:'A'


const: A const identifier can be declared a constant value using the const keyword. the constant value can not be changed.

const int data = 10;


How To Use of const keyword?

 #include<iostream>

using namespace std;

int main()

{

const int data=10;

cout<<"The value of data:"<<data;

}

*****OUTPUT*****

 The value of data:10


do-while: A do-while loop is a very most useful loop. do-while loop used the repeat the value. when they do while loop the first time executes in the program given the condition.


Syntax do-while loop

 do

{

//statement;

increment/decrement;

}

while(condition);

}


How To Use do-while loop?


 #include<iostream>

using namespace std;

int main()

{

int i=1;

do

{

               cout<<" "<<i;

               i++;

}

while(i<=10);

}

*****OUTPUT*****

1 2 3 4 5 6 7 8 9 10


double and float: double and float Keywords are used for declaring floating type value. double keywords are used for the long number of values and float is used for the floating-point value.

double data=13.75356354;

float data=13.23;


How To Use double and float

 #include<iostream>

using namespace std;

int main()

{

double data=687537332;

float d=53.2364;

cout<<"value of double number:"<<data<<"\n";

cout<<"value of floating number:"<<d;

}

*****OUTPUT*****

value of double number:687537332.000000

value of floating number:53.236401


if and else: An if-else statement is used in the decision-making condition. if the statement executes the condition is true. otherwise else statements are executed. when condition false.


Syntax of if-else statement 

 if(condition)

{

//statement;

 }

else

{

//statement;

}


How To Use of if-else statement


 #include<iostream>

using namespace std;

int main()

{

               int age;

    if (age<=18)

    {

        cout<<"You can play the PUBG Game";

  }

  else

  {

               cout<<"You can not play the PUBG Game";

  }

    return 0;

}

*****OUTPUT*****

You can play the PUBG Game


enum: An enum is named integer constants. enum is a user-defined data type. enum is an Enumeration.


Syntax of enum

enum 

enum_name{value1,value2,value3....value n}; 


How To Use of enum keyword 

 #include<iostream>

using namespace std;

enum year {

Jan,Feb,mar,api,may,June,July,Aug,sep,Oct,Nov,dec};

int main()

{

enum  year data;

data=June;

cout<<"value of june:"<<data;

}

*****OUTPUT*****

value of june:5


extern: An extern keyword is used external linking outside of the file.

for: A for loop can be Using C Language. it is the very most useful loop. Because for loop in an initiation condition and increment/deferment only one line. so for loop is the most useful loop.


Syntax of for loop

 for(initiation;condition;increment)

for(int i=1;i<=10;i++)


How To Use of for loop


 #include<iostream>

using namespace std;

int main()

{

for(int i=1;i<=10;i++)

{

cout<<" "<<i;

}

}

*****OUTPUT*****

1 2 3 4 5 6 7 8 9 10


goto: The goto statement is a jump statement control of the program to another label of the program.

int: An int keyword is used the integer type value of the c Language.

return: The return keyword terminates the function and returns the value of the c program.

size: A size of keyword has used the size of data.

register: A register keyword is used the quick access the data.it is very fast to retrieve the data from the computer. Because value stored the register.

static: Static variables are not reclaimed. They keep their value. On re-entry to the block, the variable will have its old value.

struct: A struct keyword is used for declaring a structure. A structure can behold the variables of different types with only a single name.


Syntax of structure

 struct student{

    char name[80];

     float marks;

     int age;

}s1, s2;


typedef: The C++ programming language provides a keyword called typedef, which you can use to give a type a new name. A typedef keyword can be used to long name to the small name change. typedef can Use the short name of any long variables name.

union: Union is a data type in C++ programming that allows different data types to be stored in the same memory locations. A union is used for grouping different types of variables under a single name. union is stored the single value stored. otherwise other value garbage value in the variables.

Syntax of union

 union student

Data type var1;

Data type var2;

Data type var3;

};


void: void keyword meaning nothing value the use. the void return type of the c++ program.

volatile: A volatile keyword is used for creating volatile objects. It can be used the change the value of hardware memory.



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.