हिंदी माध्यम नोट्स
C++ : ctype class in hindi , what is ctypes class with program example in c++ language
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 किया जाता है |
Recent Posts
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…