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

Programming C/C++ need a answer, 3. Write a program to encrypt and decrypt...

3. Write a program to encrypt and decrypt strings of characters using the following ciphers: a) Caesar cipher b) Vigenere cipher c) Matrix transposition cipher Your program shoul

Board coloring, in this problem u given a board in which some of the eleme...

in this problem u given a board in which some of the elements are placed as shown in diagram below .each element represent a color .fill the other elements in the board such that n

Example for register storage class - computer programming, Example for Regi...

Example for Register Storage Class - computer programming? main() { register int i; for (i=0; i { ............... ............... } } /* block exit will free the register

Define the bitwise operators in c language, Define the Bitwise Operators in...

Define the Bitwise Operators in c language? C has distinction of supporting special operators that known as bit wise operators for manipulation of data at bit level. These oper

Described friend?, A: Something to let your class to grant access to anothe...

A: Something to let your class to grant access to another class or function. Friends may be either classes or functions. Class grants access privileges to its friends. In genera

Program with various inputs-set associative cache , 1.1 A Few Notes: 1....

1.1 A Few Notes: 1. Please test your program with various inputs prior to submission. 2. All group members must understand the entire project for interactive grading. Equal

Program that predicts users age, Program: Write a program that predicts...

Program: Write a program that predicts users' age (0-128 years old) with at most 7 questions. The game starts with asking the user whether he/she is younger or older than G (an

Implementation of the stack class in c++, Implementation of the Stack class...

Implementation of the Stack class in C++: How to implement stack class in c++. int Stack::push(int elem) {    if (top    {       list[top++] = elem;       r

Program of binary tree, Program of Binary tree: Btree::Btree(int O) : ...

Program of Binary tree: Btree::Btree(int O) : itemsInContainer(0) {     finishInit(O); }   Btree::~Btree(void) {     if( root != 0 )         delete roo

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