check the entered character is capital
letter, small letter, digit or a special character
#include
#include
#include
int 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
{
char character;
cout<<"enter a character = ";
cin>>character;
int storeascii=character;
cout<<"the ascii value of "<
{
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;
}
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;
taking input in array
for(int j=0;j
int size;
cin>>size;
int array[size], key,i;
taking input in array
for(int j=0;j
{
cout<<"enter "<
cin>>array[j];
}
your entered array is
for(int a=0;a
cout<<"enter "<
}
your entered array is
for(int a=0;a
{
cout<<"array[ "< cout<
}
int maximum=array[0];
for(int i=0;i
cout<<"array[ "< cout<
int maximum=array[0];
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;
}
maximum=array[i];
}
}
cout<<"\n\nmaximum number is in array is :"<
}
Find maximum and minimum
number in array c++ code
#include
#include
#include
int main()
{
const int size=50;
array with size of 50
int array[size];
for random numbers
srand(time(0));
for(int i=0;i
#include
#include
int main()
{
const int size=50;
array with size of 50
int array[size];
for random numbers
srand(time(0));
for(int i=0;i
{
initializing array number is less than 100
array[i]=rand()%100;
displaying array value
cout<
initializing array number is less than 100
array[i]=rand()%100;
displaying array value
cout<
}
initializing max, min
int max=array[0];
int min=array[0];
scanning array to find
minimum and maximum
number
for(int i=0;i
initializing max, min
int max=array[0];
int min=array[0];
scanning array to find
minimum and maximum
number
for(int i=0;i
{
finding minimum number in array
if(min>array[i])
finding minimum number in array
if(min>array[i])
{
min=array[i];
}
finding maximum number in array
if(max
min=array[i];
}
finding maximum number in array
if(max
{
max=array[i];
}
}
displaying output
cout<<"maximum number is :"<
cout<<"minimum number is:"<
return 0;
}
max=array[i];
}
}
displaying output
cout<<"maximum number is :"<
return 0;
}