C program for 5 function of vowels, cnt_words, reverse , C/C++ Programming

Assignment Help:

C Program for 5 FUNCTION OF VOWELS, CNT_WORDS, REVERSE

void input(char a[]);

void output(char a[]);

void reverse(char a[], char b[]);

char poli(char a[], char b[]);

int count(char a[], int l[]);

void vowels(char a[]);

void main()

{

          char a[30],b[30],j;

          int i,k=0,l[30];

          clrscr();

 

          for(i=0;i<30;i++)

          {

                   a[i]='0';

                   b[i]='0';

                   l[i]=0;

          }

          input(a);

          output(a);

          reverse(a,b);

          j=poli(a,b);

          k=count(a,l);

          vowels(a);

          printf("\n\nTHE NO OF WORDS IN STRING ARE %d\n\n",k);

          if(j=='e')

          {

                   printf("\n\nIT IS PALINDROME");

          }

          else

          {

                   printf("\n\nIT IS NOT PALINDROME");

          }

          getch();

}

 

 

void input(char a[])

{

          int i=0;

          printf("ENTER THE STRING= ");

          do

          {

                   a[i++]=getchar();

 

          }while(a[i-1]!='\n');

          a[i-1]='\0';

}

void output(char a[])

{

          int i=0;

          for(i=0;a[i]!='\0';i++)

          {

                   printf("%c",a[i]);

          }

          printf("\n\n");

}

void reverse(char a[],char b[])

 

{

          int i=0,j=0;

          i=strlen(a);

          i=i-1;

          for(;i!=-1;i--)

          {

                   b[i]=a[j++];

                   printf("%c",a[i]);

          }

}

char poli(char a[], char b[])

{

          int i=0;

          char j='e';

 

          for(i=0;a[i]!='\0';i++)

          {

                   if(a[i]!=b[i])

                   {

                             j='n';

                             break;

                   }

          }

          return(j);

}

int count(char a[], int l[])

{

          int i=0,k=0,c=0;

          for(i=0;a[i]!='\0';i++)

          {

                   if(a[i]==' ')

                   {

                             k++;  c++;

                   }

 

else

                             l[c]=l[c]+1;

          }

          c=1;

          printf("\n\n");

          for(i=0;l[i]!=0;i++)

          {

printf("THE NO OF CHARACTERS IN %d WORD ARE %d\n",c,l[i]);

                   c++;

          }

          k++;

          return(k);

}

void vowels(char a[])

{

          int j=0,a1=0,e=0,i=0,o=0,u=0,l[30],c=0;

          for(j=0;j<30;j++)

                   l[j]=0;

          for(j=0;a[j]!='\0';j++)

          {

                   if(a[j]=='a' || a[j]=='A')

                   {

                             a1++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='e' || a[j]=='E')

                   {

                             e++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='i' || a[j]=='I')

                   {

                             i++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='o' || a[j]=='O')

                   {

                             o++;

                             l[c++]=j+1;

                   }

                   if(a[j]=='u' || a[j]=='U')

                   {

                             u++;

                             l[c++]=j+1;

                   }

          }

          printf("THE NO OF VOWELS \"a\" AND \"A\" ARE %d\n",a1);

          printf("THE NO OF VOWELS \"e\" AND \"E\" ARE %d\n",e);

          printf("THE NO OF VOWELS \"i\" AND \"I\" ARE %d\n",i);

          printf("THE NO OF VOWELS \"o\" AND \"O\" ARE %d\n",o);

          printf("THE NO OF VOWELS \"u\" AND \"U\" ARE %d\n",u);

}

 

OUTPUT :

ENTER THE STRING:

SHIVANI PRERNA SHRIDEVI VIRAL KAMLESH  

HSELMAK LARIV IVEDIRHS ANRERP INAVIHS

THE NO OF CHAR IN 1 WORD ARE 7

THE NO OF CHAR IN 1 WORD ARE 6

THE NO OF CHAR IN 1 WORD ARE 8

THE NO OF CHAR IN 1 WORD ARE 5

THE NO OF CHAR IN 1 WORD ARE 7

 

 

OUTPUT :

THE NO OF VOWELS A  2

THE NO OF VOWELS E  3

THE NO OF VOWELS  I  5

THE NO OF VOWELS O  0

THE NO OF VOWELS U  0

THE NO OF WORDS IN THE STRING 5

IT IS NOT PALINDROM

 


Related Discussions:- C program for 5 function of vowels, cnt_words, reverse

Write program.., # Dear I want help to programmer that write C++ code for...

# Dear I want help to programmer that write C++ code for my small project as soon as posible If we can help me?..

Program for greatest common divisor – c++ program, Greatest Common Divisor ...

Greatest Common Divisor (GCD) - The greatest common divisor (GCD) of two integers is the largest integer that will evenly divide both integers. The GCD algorithm involves intege

File, how i can open a file

how i can open a file

C program, Just need the answers to the following 3 questions. "NO NEED to ...

Just need the answers to the following 3 questions. "NO NEED to write a program compile or run it, do not need it. Just need the answers for the following questions. Example quest

Pseudocode , Record separation problem Let us assume that a particular data...

Record separation problem Let us assume that a particular database program manages a simple mailing list which consists of one record for each person on the list, and a number of f

What is your reaction to following line of code? , Q-What is your reaction ...

Q-What is your reaction to following line of code?               delete this; A: This is not a good programming Practice. A good programmer will insist that you must absolute

Display an array using standard input, Stage One Define the specification o...

Stage One Define the specification of the program            Add two nxm size matrices   Stage Two Divide the program up into separate modules           Input Matrix         Ad

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd