Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <cctype> #include<iostream> using namespace std; bool isvowel (char); i

ID: 3625161 • Letter: #

Question

#include <cctype>
#include<iostream>
using namespace std;

bool isvowel (char);

int main ()
{
int n,i=0,count=0;
bool result;
char c;
cout << " Enter a number of characters ";
cin >> n;
cout << " Enter the character " << endl;
while (i<=n)
{
cin >> c;
result=isvowel (c);
if (result == true)
count++;
i++;
}

cout << " Number of vowels is : " << count << endl;
system ("pause");
}

bool isvowel (char x)
{
if (x=='a' || x=='e' || x=='i' || x=='o' || x=='u' || x=='A' || x=='E' || x=='I'|| x=='O' || x=='U' )
{
return true;
}
else
{
return false;
}
}

Explanation / Answer

// its working dude :)

#include <cctype>
#include<iostream>
using namespace std;

bool isvowel (char);

int main ()
{
int n,i=0,count=0;
bool result;
char c;
cout << " Enter a number of characters ";
cin >> n;
cout << " Enter the character " << endl;
while (i<=n)
{
cin >> c;
result=isvowel (c);
if (result == true)
count++;
i++;
}

cout << " Number of vowels is : " << count << endl;
// system ("pause");
}

bool isvowel (char x)
{
if (x=='a' || x=='e' || x=='i' || x=='o' || x=='u' || x=='A' || x=='E' || x=='I'|| x=='O' || x=='U' )
return true;
else
return false;
}