C++ Program to Find the Number of Vowels, Consonants, Digits and White Spaces in a String

In this tutorial you will learn about the C++ Program to Find the Number of Vowels, Consonants, Digits and White Spaces in a String and its application with practical example.

 

Table Of Contents

In this tutorial, we will learn to create a C++ program that will Find the Number of Vowels, Consonants, Digits, and White Spaces in a String in C programming

Prerequisites

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

  • Operators in C++ Programming.
  • Basic Input and Output function in C++ Programming.
  • Basic C++ programming.
  • For loop in C++ programming.

About The Program

The string is a collection of numbers, vowels, consonants, and white spaces. In today’s program, we will count the vowels, consonants, digits, and white spaces from the input string. For this, we will pass that string to multiple conditions and loop to remove the vowels, consonants, Digits, and blank spaces.

Algorithm:-

 

Program to count Number of Vowels, Consonants, Digits and White Spaces:-

 

Output:-

In the above program, we have first initialized the required variable.

 

  • str[] = it will hold the string value.
  • vowels = it will hold the integer value for vowels.
  • consonant  = it will hold the integer value for consonants.
  • digits = it will hold the integer value for numbers.
  • spaces = it will hold the integer value for spaces.

Input strings from the user.

Calculating the Number of Vowels, Consonants, Digits, and White Spaces in a String.

Printing output.

In this tutorial we have learn about the C++ Program to Find the Number of Vowels, Consonants, Digits and White Spaces in a String and its application with practical example. I hope you will like this tutorial.