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

Program for basically a small store, ¦It should ask customers to enter deta...

¦It should ask customers to enter details such as their names and addresses. ¦It should print a welcome message that includes the customer’s name. ¦It should provide a list of avai

Assigment, Hi is there any chance to get assignment for fresher tutor

Hi is there any chance to get assignment for fresher tutor

Stack operations - c++, Stack operations - C++: Write a program to def...

Stack operations - C++: Write a program to define basic stack operations in c++. int Stack::push(int elem) {    int m = getmax();    if (top    {       put_

Program for read a formal expression from standard input, Your program will...

Your program will read two kinds of data from two files: names and predicates. It will read a formal expression from standard input and check whether that expression is syntactical

Scrape a site and save as csv, Scrape a site and save as csv Project Des...

Scrape a site and save as csv Project Description: I want a programmer to create scraping software. I'll want every page scraped of name, job title, company, and url. There a

Explain some string oriented library functions, Explain some String Oriente...

Explain some String Oriented Library Functions? To make simpler string processing we can use special string oriented library functions. Mainly the C compilers include library f

Insert values in queue - c++ program, Insert values in queue - C++ program:...

Insert values in queue - C++ program: Write a program to insert values in queue. int main()   {         int k;     Queue timeLine;     cout     for(

C program, Write a ‘C’ program to accept any 3 digit integer number from th...

Write a ‘C’ program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.

Explain topologies for the network information system, Problem: a) Give...

Problem: a) Give and Illustrate with the help of diagrams, four topologies for the Network Information System (NIS). b) Give methods for creating user accounts and groups.

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