#include <iostream> #include <string.h> using namespace std; #define MAX 100 //prototypes / function(s) declaration void input(char line[]); void proc(char line[],int& vow,int& a,int& e,int& i,int& o,int& u); void display(const int& vow,const int& a,const int& e,const int& i,const int& o,const int& u); int main() { // system("color f1"); //for changing the color of output screen //declaration / initialization char line[MAX]; int vow=0,a=0,e=0,i=0,o=0,u=0; //function(s) calling input(line); proc(line,vow,a,e,i,o,u); display(vow,a,e,i,o,u); // system("pause"); }//end of main void input(char line[]) { cout<<"Enter the line of text to FINISH press Enter Key : \n"; cin.getline(line,MAX); }//end of input void proc(char line[],int& vow,int& a,int& e,int& i,int& o,int& u) { int len=strlen(line); //getting the length of string for(int n=0; n<len-1;n++) { if((line[n]=='A')||(line[n]=='a')) { vow++; a++; } else if((line[n]=='E')||(line[n]=='e')) { vow++; e++; } else if((line[n]=='I')||(line[n]=='i')) { vow++; i++; } else if((line[n]=='O')||(line[n]=='o')) { vow++; o++; } else if((line[n]=='U')||(line[n]=='u')) { vow++; u++; } }//end of for }//end of proc void display(const int& vow,const int& a,const int& e,const int& i,const int& o,const int& u) { cout<<"\n\nVowels found = "<<vow<<"\n\n'A' found = "<<a<<"\n'E' found = "<<e<<"\n'I' found = "<<i<<"\n'O' found = "<<o<<"\n'U' found = "<<u<<endl<<endl; }//end of display
Subscribe to:
Post Comments (Atom)
Post A Comment:
0 comments: