JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: c++ language in hindi

C++ : ctype class in hindi , what is ctypes class with program example in c++ language

what is ctypes class with program example in c++ language , C++ : ctype class in hindi :-
इससे पहले के article मे केवल string class के function को दिचुस किया है ?| अब इस article मे ctype class मे उपस्थित  member फ़ुन्क्तिओन्स को discuss किया जाता है |
ctype class
ctype class मे define function का use character पर किया जाता है | ये function का use character पर basic uppercase , lowercase को  check और convert करने के लिए किया जाता है |  नीचे इन्हें functions को discuss करेगे :-1.isalnum()
इस function से alpha numerical character को check करने  के लिए किया जाता है | अगर character alphabetnumerical होता है तब ‘1’ return होता है अन्यथा ‘0’ return होगा
इसका उदाहरन होगा :
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string user_name ;
cout<<“Enter User name : “;
cin>>user_name;
int count =0;
int length = strlen(user_name);
for(int i =0;i<=length ; i++)
{
if (isalnum (user_name[i]))
{
count =1;
}
}
if(count == 1 )
{
cout<<“user_name is alphabetnumerical. “;
}
else
{
cout<<“user_name is not alphabetnumerical. “;
}
getch();
}
इस उदाहरन मे  user name को input किया जाता है |  और loop मे यूजर name के प्रत्येक character को inalnum() से check किया जाता है | अगर यूजर name में sepacial character होता है तब user_name is not alphabetnumerical. display होता है |

1.isalpha()
इस function से alphabetic character को check करने  के लिए किया जाता है | अगर character alphabetical होता है तब ‘1’ return होता है अन्यथा ‘0’ return होगा
इसका उदाहरन होगा :
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string user_name ;
cout<<“Enter User name : “;
cin>>user_name;
int count =0;
int length = strlen(user_name);
for(int i =0;i<=length ; i++)
{
if (isalpha (user_name[i]))
{
count =1;
}
}
if(count == 1 )
{
cout<<“All Character are alphabets in user name . “;
}
else
{
cout<<“All Character are not alphabets in user name . “;
}
getch();
}
इस उदाहरन मे  user name को input किया जाता है |  और loop मे यूजर name के प्रत्येक character को inalpha() से check किया जाता है | अगर यूजर name में sepacial character होता है तब user_name is not alphabetical. display होता है |

3.isblank
इस function से blank character को check करने  के लिए किया जाता है | अगर argumnet मे blank character होता है तब ‘1’ return होता है अन्यथा ‘0’ return होगा
इसका उदाहरन होगा
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string user_name ;
cout<<“Enter User name : “;
cin>>user_name;
int count =0;
int length = strlen(user_name);
for(int i =0;i<=length ; i++)
{
if (isblank(user_name[i]))
{
count =1;
}
}
if(count == 1 )
{
cout<<“User name have blank character . “;
}
else
{
cout<<“User name have not  blank character .  “;
}
getch();
}
इस उदाहरन मे  user name को input किया जाता है |  और loop मे यूजर name के प्रत्येक character को inblank() से check किया जाता है | अगर यूजर name में कोई भी character blank space नहीं होता है तब User name have not  blank character .   display होता है |

4.isdigit
इस function से numerical character को check करने  के लिए किया जाता है | अगर argumnet मे  सभी character , numerical character होता है तब ‘1’ return होता है अन्यथा ‘0’ return होगा
इसका उदाहरन होगा
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string employee_ID ;
cout<<“Enter ID: “;
cin>>employee_ID;
int count =0;
int length = strlen(employee_ID);
for(int i =0;i<=length ; i++)
{
if (isdigit(employee_ID[i]))
{
count =1;
}
}
if(count == 1 )
{
cout<<” ID have digits only. “;
}
else
{
cout<<” ID have alphanumerical. “;
}
getch();
}
इस उदाहरन मे  ID को input किया जाता है |  और loop मे ID के प्रत्येक character को isdigit() से check किया जाता है | अगर यूजर name में कोई भी character digit होता है तब ID have digits only.display होता है |

इसके अलावा निन्म function को use किया जाता है :-
5.islower () :
इस function से lowercase character को check करने  के लिए किया जाता है | अगर argumnet मे  सभी character , lowercase character होता है तब ‘1’ return होता है अन्यथा ‘0’ return होगा
इसका उदाहरन होगा
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string name  ;
cout<<“Name : “;
cin>>name ;
int count =0;
int length = strlen(name);
for(int i =0;i<=length ; i++)
{
if (islower(name[i]))
{
count =1;
}
}
if(count == 1 )
{
cout<<“All Character are lower case. “;
}
else
{
cout<<” All Character are not lower case. “;
}
getch();
}
इस उदाहरन मे  name को input किया जाता है |  और loop मे name के प्रत्येक character को islower() से check किया जाता है | अगर यूजर name में कोई भी character lower case होता है तब All Character are lower case. display होता है |

6.isupper() :
इस function से uppercase character को check करने  के लिए किया जाता है | अगर argumnet मे  सभी character , uppercase character होता है तब ‘1’ return होता है अन्यथा ‘0’ return होगा
इसका उदाहरन होगा
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string name  ;
cout<<“Name : “;
cin>>name ;
int count =0;
int length = strlen(name);
for(int i =0;i<=length ; i++)
{
if (isupper(name[i]))
{
count =1;
}
}
if(count == 1 )
{
cout<<“All Character are upper case. “;
}
else
{
cout<<” All Character are not upper case. “;
}
getch();
}
इस उदाहरन मे  name को input किया जाता है |  और loop मे name के प्रत्येक character को isupper() से check किया जाता है | अगर यूजर name में कोई भी character uppercase होता है तब All Character are uppercase. display होता है |

7.toupper()
इस function से ,lower case character को uppercase character को convert करने  के लिए किया जाता है |
इसका उदाहरन होगा
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string name ,name1 ;
cout<<“Name : “;
cin>>name ;
int count =0;
int length = strlen(name);
for(int i =0;i<=length ; i++)
{
name1[i]=toupper(name[i]);
}
cout<<“Uppercase Name :”<<name1 <<endl;
getch();
}
इस उदाहरन मे  name को input किया जाता है |  और loop मे name के प्रत्येक character को isupper() से  convert करके name1 मे assign किया जाता है | उसके बाद name1 को display किया जाता है |

7.tolower ()
इस function से ,uppercase character को lowercase character को convert करने  के लिए किया जाता है |
इसका उदाहरन होगा
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
string name ,name1 ;
cout<<“Name : “;
cin>>name ;
int count =0;
int length = strlen(name);
for(int i =0;i<=length ; i++)
{
name1[i]=tolower(name[i]);
}
cout<<“lowercase Name :”<<name1 <<endl;
getch();
}
इस उदाहरन मे  name को input किया जाता है |  और loop मे name के प्रत्येक character को islower() से  convert करके name1 मे assign किया जाता है | उसके बाद name1 को display किया जाता है |

इस article मे , ctype class के सबसे ज्यादा use किये जाने वाले function को discuss किया जाता है | इस functions को use करके , प्रोग्रामर अपनी programming skills को improve किया जाता है |

Sbistudy

Recent Posts

Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic

Question Tag Definition • A question tag is a small question at the end of a…

2 weeks ago

Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)

Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…

2 weeks ago

Report Writing examples in english grammer How to Write Reports explain Exercise

Report Writing • How to Write Reports • Just as no definite rules can be laid down…

2 weeks ago

Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th

Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…

2 weeks ago

विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features

continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…

2 weeks ago

भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC

भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…

2 weeks ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now