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

Array, how to use nested loop of for in array

how to use nested loop of for in array

Strings, A string S is said to be "Super ASCII", if it contains the charact...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

Maths, .Write a program to find the area under the curve y = f(x) between x...

.Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

Decoding , http://www.expertsmind.com/questions/decodethecode-30110560.aspx...

http://www.expertsmind.com/questions/decodethecode-30110560.aspx

Define namespace in c++, It is a feature in C++ to reduce name collisions i...

It is a feature in C++ to reduce name collisions in the global name space. This namespace keyword assigns a separate name to a library that allows other libraries to use the simila

Memory allocation for objects, when a class is defined the compiler will no...

when a class is defined the compiler will not allocate memory. This is true only for data member not for member function.  As soon as the member function is defined  the require

Chapter 21, Test scores solution help. Three member variables

Test scores solution help. Three member variables

Android - iphone mobile game, I am seeking a developer to create a mobile g...

I am seeking a developer to create a mobile game for me. I want an endless runner game with simple controls. The game needs to be a 3D game in a 2D view. The graphics and animation

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