Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
How to print vowels from array

Hey dear able to honor!

I'm writing a program of my assignment in which I'll need to show my full name and my I'd. using an array and also find vowels from my name and show them one by one in a column and also total numbers of vowels at the end. I did the first target and also done showing the total number of vowels, while I try too much to show vowels one by one with numbers like the following picture but I can't anyone can help so, please...

This image shows how to print out vowels

if the Image is not open so image text is like something this:

My first name is: Bilal
MY I'd is: bc1234567890
last digit of i'd is: 0

vowel no 1 is: i
vowel no 2 is: a

Total vowels in my first name: 2

I tried this:

//for first name vowels
for(i1=0;i1<n1a[i1];i1++)
{
    switch(n1a[i1])
    {
        case 'A':
        case 'a':
        case 'E':
        case 'e':
        case 'I':
        case 'i':
        case 'O':
        case 'o':
        case 'U':
        case 'u':
        counter1++;
        break;
    }
    for(y=1;y<=counter1;y++)
    {
        cout<<"Vowel "<<y<<" is: "<<n1a[i1]<<endl;
    }
}
cout<<endl;
cout<<"Total Vowels Is/Are: "<<counter1<<endl;
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It seems you mean the following for loop

for(i1=0; n1a[i1] != '\0'; i1++)

Within the switch statement write

for(i1=0; n1a[i1] != '\0'; i1++)
{
    switch(n1a[i1])
    {
        case 'A':
        case 'a':
        case 'E':
        case 'e':
        case 'I':
        case 'i':
        case 'O':
        case 'o':
        case 'U':
        case 'u':
        counter1++;
        std::cout << "Vowel no " << counter1 << ": " << n1a[i1] << '\n';
        break;
    }
    //...
 

Or if the variable n1a has the type std::string then

for ( char c : n1a )
{
    switch( c )
    {
        case 'A':
        case 'a':
        case 'E':
        case 'e':
        case 'I':
        case 'i':
        case 'O':
        case 'o':
        case 'U':
        case 'u':
        counter1++;
        std::cout << "Vowel no " << counter1 << ": " << c << '\n';
        break;
    }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!