Write a program that inputs data into a string and searches the ‘vowel’ characters from the string and displays on the screen.
So let’s Write Code:
Code:
Write a program that inputs data into a string and searches the ‘vowel’ characters from the string and displays on the screen.
#include<iostream>
using namespace std;
main()
{
char str[20], n;
cout<<"Enter a string less than 20 letters ? ";
cin>>str;
cout<<"\n Vowel characters from the string are:"<<endl;
for(n = 0; str[n]!='\0'; n++)
{
if(str[n] == 'a' || str[n] == 'A' || str[n] == 'e' || str[n] == 'E' || str[n] == 'i' || str[n] == 'I'
|| str[n] == 'o' || str[n] == 'O' || str[n] == 'u' || str[n] == 'U')
cout<<str[n]<<endl;
}
}
Hope You will learn Something. Happy Coding.
Visit my YouTube Channel as Well😇 https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4
Click on the below Links for more Programming Exercises:
Conditional Structure Exercises: 👉https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/
Array Exercises: 👉https://myustaadg.com/category/programming-exercises/arrays-exercises/