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

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

 

Posted Date: 9/10/2012 7:18:43 AM | Location : United States







Related Discussions:- C program for reverse the word in string, Assignment Help, Ask Question on C program for reverse the word in string, Get Answer, Expert's Help, C program for reverse the word in string Discussions

Write discussion on C program for reverse the word in string
Your posts are moderated
Related Questions
The following is the formula that can be used to complete that calculation: Monthly Payment = Monthly Interest Rate / (1 - (1 + Monthly Interest Rate) -Payment Interval )) *

Custom Scans and Alerts Think or Swim Project Description: I am seeking somebody to make me several Custom Scans and Alerts on Thinkorswim TOS Skills required are C++ Prog

A Constructive Example Consider an example , to model a user-defined data type for  strings. The object simulates a character array ( string ) using a character pointer and an

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Q: In p = new Fred(), does the Fred memory "leak" if  Fred constructor throws an exception? A: No.         If an exception take place during the Fred constructor of p = new F

Data is required to be fed into the program (input) and sent out of the program (output). Considering the draughtsman using a CAD station, the input is his commands to cause lines/

one of the applications of computers in numerical analysis is computing the area under a curve. one method of calculating the area under acurve is to divide the area int a number o

(a) Write a procedure that computes the Ackermann-Peter a(m,n) function. (b) Write a helper procedure that only allows the calculation of the Ackermann-Peter function for 0≤m

Define a complex number in c program: class complex                                 {                                   private:                                 in

Various ways of initializing the Arrays. - The for loop initializes 10 elements with the value of their index.      void main()     {                 const in