DEV Community

Md. Taosif
Md. Taosif

Posted on

cse110

if the input is digit or character or special characcter

include

using namespace std;
int main() {
char ch;
ch=cin.get();
if (ch==' ' || ch=='\n'){
cout<<"whitespace";
}
else if (ch>='A'&& ch<='Z'||ch>='a' && ch<='z'){
cout<<"character";
}
else if (ch>='0' and ch<='9'){
cout<<"digit";
}
else{
cout<<"special";
}

return 0;
Enter fullscreen mode Exit fullscreen mode

}

for convert asci

##ch a ='something'

(char) a
(int) a
to read all input we need to use
ch=cin.get()
for all asci value

include

using namespace std;
int main() {
int i =0;
for (i=0;i<=122;i++){
cout<<i<<"---"<<(char)i<<endl;
}

return 0;
Enter fullscreen mode Exit fullscreen mode

}

incluse

cctype
if(isupper(ch)){
cout<<}
islower()
isdigit()
toupper()
tolower(

to get full string input we need to use
getline(cin,somthing)

string name
cin>>name
getline(cin,name)

for loop
for (char i : name){
}

Top comments (1)

Collapse
 
sloan profile image
Sloan the DEV Moderator

Just wanted to say welcome to everyone new and not-so-new to DEV. ๐Ÿ‘‹

Hope y'all enjoy it here!

If you're wondering how to get started with posting a post, then consider checking out this article here.

If you're wondering anything else, don't hesitate to reach out and ask. ๐Ÿ˜€