Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda