C program for reverse the word in string, C/C++ Programming

Assignment Help:

C Program for REVERSE THE WORD IN STRING

#include conio.h>

#include stdio.h>

#include string.h>

void main()

{

          char a[50],b[25][25],temp;

          int i=0,j=0,k=0,l[25],c=0,c1=0,t=0;

          clrscr();

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

          {

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

                   {

                             l[i]=0;

 

                             b[i][j]=0;

                   }

          }

          i=0;

          j=0;

          printf("ENTER THE STRING: ");

          do

          {

                   a[i++]=getchar();

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

          a[i]='\0';

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

          {

                   if(a[i]!=' ' && a[i]!='\n')

                   {

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

                             b[c][c1++]=a[i];

                   }

                   else

                   {

                             c++;

                             c1=0;

                   }

          }

          c=0;

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

          {

                   for(j=0;b[i][j]!=0;j++)

                   {

if(b[i][j]=='A' || b[i][j]=='a' || b[i][j]=='E' || b[i][j]=='e' || b[i][j]=='I' || b[i][j]=='i' || b[i][j]=='O' || b[i][j]=='o' || b[i][j]=='U' || b[i][j]=='u')

                             {

                                      c=1;

                             }

                   }

 

                   if(c==1)

 

                   {

                             c1=l[i];

                             c1--;

                             t=l[i];

                             t=t/2;

                             for(k=0;k

                             {

                                      temp=b[i][k];

                                      b[i][k]=b[i][c1];

                                      b[i][c1]=temp;

                                      c1--;

                             }

                             c=0;

                   }

          }

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

          {

                    printf("%s ",b[i]);

          }

          getch();

}

OUTPUT :

ENTER THE STRING: KAMLESH D MENGAR

HSELMAK D RAGNEM

 


Related Discussions:- C program for reverse the word in string

Define passing by reference?, A: Method of passing arguments to a function ...

A: Method of passing arguments to a function that takes parameter of type reference.  for instance: void swap( int & x, int &amp;amp; y ) { int temp = x; x =

Discount program, Build a program that calculates a discount for items base...

Build a program that calculates a discount for items based on quantity bought each item is $99.99 Ask user to enter the quantity of the items Get the quantity of items from the u

It/218.., Write a program that does the following: Calculates the Velocity ...

Write a program that does the following: Calculates the Velocity and Momentum of an object. The formula for the velocity is V=d/t and the formula Momentum is m=mass*velocity. Your

Inline functions, Inline functions, C++ provides inline functions to help r...

Inline functions, C++ provides inline functions to help reduce function_call overhead especially for small functions. The qualifier inline before function's return type in the f

Padovan string, padovan string generation till 40

padovan string generation till 40

Flow chart, how made a flow chart of prime number by using for loop

how made a flow chart of prime number by using for loop

C++ class, need to create c++ classes to store all pascal types in compiler...

need to create c++ classes to store all pascal types in compiler design.

Need ftp upload and mysql, Need FTP Upload and MySQL Project Description...

Need FTP Upload and MySQL Project Description: We are in need of an executable application that will be execute as a scheduled task on Windows Server 2008 R2 and can perform

Conversion operator, What is conversion operator? Explain it with example.

What is conversion operator? Explain it with example.

A palindrome is a string that reads the same from both the e, submitting so...

submitting solutions in C language should not use functions from / as these files do not exist in gcc

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