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;
}
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;
}
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)
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.
How to Write Your First Post on DEV
Chris Achard ใป Sep 5 '19 ใป 3 min read
If you're wondering anything else, don't hesitate to reach out and ask. ๐