64 765
Assignments Done
99,3%
Successfully Done
In September 2018

Answer to Question #49710 in C++ for nada

Question #49710
Write C++ program that reads the string and prints the vowels and their number. The program takes a string from the user and stores it in a character array and store all its vowels in another array of type char and counts the number of vowels found.
Expert's answer
 
#include<iostream.h>
#include<string.h>
#define MAX 1000
 
int main()
{
     char *s=new char[MAX], *vowelsS=newchar[MAX];
     char vowel[13];
     strcpy(vowel,"EeUuIiOoAa");
     inti,j, n=0;
     cout<<"Input the string:";
     cin.getline(s,MAX);
     for(i=0;i<strlen(s);i++)
        for(j=0;j<strlen(vowel);j++)
          if(s[i]==vowel[j])
            {
            vowelsS[n]=vowel[j];
            n++;
            break;
            }
     vowelsS[n]='\0';
     cout<<"vowels of string:"<<vowelsS<<", total count: "<<n;
     return 0;    
 }


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions