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

Procedure to compute recursive and iterative process, Consider the followin...

Consider the following mathematical function: (a) Write a procedure that computes f by means of a recursive process (b) Write a procedure that computes f by means of an

C program to demonstrate pointer to variable, C program to demonstrate Poin...

C program to demonstrate Pointer to variable: void p2a(int *); void main() {                 int x=10, *a,**b;                 int arr[5];                 //poin

If one won''t explicitly call the destructor of a local then , if one won't...

if one won't explicitly call the destructor of a local; then how does he handle the above situation?

Algorithm, Write an algorithm to print all even numbers in descending order...

Write an algorithm to print all even numbers in descending order and draw the flowchart.

C++ program, Receive 3 numbers and display them in ascending order from sma...

Receive 3 numbers and display them in ascending order from smallest to largest ed#

Area under curve, write a program to find the area under the curve y=f(x) b...

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 #include float start_point,

Program to define simulation method, This problem familiarizes you with usi...

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of π using a simulation method called "Monte Carlo". The following fi

Program to create local shopping cart, Available, and the right kind of pro...

Available, and the right kind of programs. My son wants to stop using ice. He has organised detox a number of times, and is always successful. It is the next stage, rehab, where

Define constructors-extract and insert operators, For your class to work pr...

For your class to work properly, you'll need to define appropriate constructors, extract and insert operators, and of course arithmetic operators. (If you wanted to use it as a gen

Define the data type modifiers in c language, Define the Data Type Modifier...

Define the Data Type Modifiers in C language? There are three data types(int, float & double) above have the following modifiers. 1. short 2. long 3. signed 4. unsigned

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