C++ Program to Count Vowels in String

In this tutorial you will learn about the C++ Program to Count Vowels in String and its application with practical example.

In this tutorial, we will create a c++  program to count vowels in entered string by the user using c++ programming.

Table Of Contents

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • Operators
  • Condition statement.
  • Array.
  • Strings.
  • logical operator.

What Is Vowel and Consonant?

Vowel :=> Sound that allowing breath to flow out of mouth, without closing any part of the mouth.
Consonant:=> Sound  made by blocking air from flowing out of the mouth with the teeth or throat.
Example

As we know A E I O U are called vowels. And renaming alphabets except these 5 vowels are called consonants.

C++ Program to Count Vowels in String.

Output

In the above program, we have first declared a variables required in the program.

  • strng= hold given string.
  • i= for iteration.
  • vow= to count vowels in a string.

First of all we will  prompted  user to enter any string.Then with the help of program we will find  the number of vowel in  inputted string using following logic.

As user inputs any string we check all vowel with in the string in both lower-case and upper-case as shown in above example using for loop we Initialize for loop and terminate it at the end of string.

As show in above here we will  check  the entire string with in the loop and count the number of vowels in a string .After the completion of a loop.we will get the number  vowel in a following  string and print total number vowel present within the string.

In this tutorial we have learn about the C++ Program to Count Vowels in String and its application with practical example. I hope you will like this tutorial.