write a program to accept a string from user . Pass the string to a function called consonants ( String Str ) which displays the consonants present in the string and vowels present in the string.
Answers
Answered by
1
Answer:
This program is written in c++
#include<iostream>
using namespace std;
void consonant(string str)
{
string vow="",cons="";
for(int i=0;i<str.size();i++)
{
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u'||str[i]=='A'||str[i]=='E'||str[i]=='I'||str[i]=='O'||str[i]=='U')
vow+=str[i];
else
cons+=str[i];
}
cout<<vow<<endl;
cout<<cons<<endl;
}
int main()
{
string str;
cin>>str;
consonant(str);
return 0;
}
Similar questions