C++ program to check the entered character
is capital letter, small letter, digit or a special character
#include
#includeint main() { char character; cout<<"enter a character = "; cin>>character; int storeascii=character; cout<<"the ascii value of "< if (storeascii>=65 && storeascii<=90) { cout<<"\nyou have entered a capital letter"; }
else if (storeascii>=97 && storeascii<=122)
{
cout<<"\nyou have entered a small letter";
}
else if (storeascii>=47 && storeascii<=57)
{
cout<<"\nyou have entered a digit ";
}
else if (storeascii>=0 && storeascii>=47
storeascii>=54 && storeascii<=64
storeascii>=91 && storeascii<=96
storeascii>=123 && storeascii<=127)
{
cout<<"\nyou have entered a special character";
}
return 0;
}
{
cout<<"\nyou have entered a small letter";
}
else if (storeascii>=47 && storeascii<=57)
{
cout<<"\nyou have entered a digit ";
}
else if (storeascii>=0 && storeascii>=47
storeascii>=54 && storeascii<=64
storeascii>=91 && storeascii<=96
storeascii>=123 && storeascii<=127)
{
cout<<"\nyou have entered a special character";
}
return 0;
}
Maximum or largest number in array c++ code
#include
#include
int main() {
cout<<"enter the size of array: ";
int size;
cin>>size;
int array[size], key,i;
int size;
cin>>size;
int array[size], key,i;
taking input in array
for(int j=0;j
for(int j=0;j
{
cout<<"enter "<
cin>>array[j];
}
your entered array is
for(int a=0;a
cout<<"enter "<
cin>>array[j];
}
your entered array is
for(int a=0;a
int maximum=array[0];
for(int i=0;i
for(int i=0;i
{
if(array[i]>maximum)
if(array[i]>maximum)
{
maximum=array[i];
}
}
cout<<"\n\nmaximum number is in array is :"<
return 0;
}
}
}
cout<<"\n\nmaximum number is in array is :"<
return 0;
}
No comments:
Post a Comment