how to write program enter a sentence and output the number ofuppercase & lowercase consonants, uppercase & lowercase vowels in sentence.

Join Our Official AiJobsAdda Telegram Channel

Hello friends, Welcome to your Techgsr.co blog. And today in this article we will learn about how to write program enter a sentence and output the number ofuppercase & lowercase consonants, uppercase & lowercase vowels in sentence.So let’s go to our topic

#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
char line[80];
int number_of_vowels,uc,lc,uv,lv;
uc=lc=uv=lv=0;
cout << “Enter your sentence : ” << endl;
cin.getline(line,80);
for(int x=0; line[x]!=’\0’;x++)
{
if(line[x]==‘A’||line[x]==‘E’||line[x]==‘I’||line[x]==‘O’||line[x]==‘U’)
uv++;
else if(line[x]==‘a’||line[x]==‘e’||line[x]==‘i’||line[x]==‘o’||line[x]==‘u’)
lv++;
else if(line[x]>+65&&line[x]<=90)
uc++;
else if (line[x]>=97&&line[x]<=122)
lc++;
}
//Printing the output.
cout << “Uppercase Consonants = ” << uc << “.” << endl;
cout << “Lowercase Consonants = ” << lc << “.” << endl;
cout << “Uppercase Vowels = ” << uv << “.” << endl;
cout << “Lowercase Vowels = ” << lv << “.” << endl;number_of_vowels=uv+lv;
cout << “Number of vowels = ” << number_of_vowels << endl;
getch();
}

 

This program takes in a sentence as a screen input from the user.
It then computes the number of uppercase and lowercase consonants, uppercase and
lowercase vowels and the total number of vowels.
It then outputs it using the ‘cout’ command.
INPUT :
These programs are truly AMAZING
OUTPUT :
Uppercase Consonants = 5.
Lowercase Consonants = 13.
Uppercase Vowels = 3.
Lowercase Vowels = 7.
Number of vowels = 10

Related Post:-

Predict the output of following C++ program in cpp

Print 1 to 100 in C++, without loop and recursion

Factorial Using Loop Example Program In C++

bfs algorithm in data structure (BFS)

if..else Statement Example Program In C++

For Loop Example Program In C++

Program to find the sum of each row & column of a matrix of size n x m andif matrix is square, find the sum of the diagonals also.

 tudo app using html and css javascript

how to create age calculator in html project

how to make toast in html css and javascript

how to make copy to clipboard in javascript

how to create email validation in javascript

So I hope that you learn about the  Predict the output of following C++ program in cpp And if you have any more queries about computer relegated then feel free to discuss your problem in the comment section.Thank you so much and come back for more updates about Techgsr.co .