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

If else, A small shop sells 280 different items. Every item is identified b...

A small shop sells 280 different items. Every item is identified by a 3 - digit code. All items which start with a zero (0) are cards, all items which start with a one (1) are swee

How to make a triangle number, i wont to make triangle with number but numb...

i wont to make triangle with number but number from the largest possible number to 01 (reversed).

Area under the curve, Write a program to find the area under the curve y = ...

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. The area under a curve between two points can b

Exceptions handling in cpp, Exceptions. Your SVector class should throw fou...

Exceptions. Your SVector class should throw four exceptions: 3.1. If the constructor size is invalid, then it will just allow the implicit STL bad_alloc exception to pass up to mai

Define an asset base class, a) Define an Asset base class that provides the...

a) Define an Asset base class that provides the following method: class Asset { public:      virtual double getValue()=0; };   This will be the base class for both stock an

Decodethecode.h, decodes the sending smuggler string from the number format...

decodes the sending smuggler string from the number format into plain text

User-defined data type, Explain  U s e r - D e f i n e d D a t a...

Explain  U s e r - D e f i n e d D a t a T y p es? C has Union and Structure as user-defined data types.  C++ has class which looks like structure with a

PROGRAMMING, PROCEDUAL PROGRAMMING INTRODUCTION

PROCEDUAL PROGRAMMING INTRODUCTION

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