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
An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase. For example the anagram of tea is tea, tae, eat, eta,

#C Why don''t online compilers support the header file? What can I do to resolve this? PS. I have tried , does''nt work either. Thannk in advance.

This task involves char arrays and pointer based string handling. Which we use to make a simple encryption program, using a Caesar Cipher, Write a program that: a. Asks

: Write a program that prompts the user to enter five digit positive numbers. The program then outputs the digits of the number one digit per line. Eg if the user enters 32456, th

C Program for FUNCTION OF MERGE #include conio.h> #include stdio.h> char cot(char a[],char b[]); void main() {           char a[50],b[50];           clrscr()

Define Bitwise Left Shift and Right Shift Operators: >? The bitwise shift operators shift their first operand right (>>) or left ( // Illustration of the bitwise right shi

Floating  literal They can be written in common decimal as well as scientific notation (floating point representation). By default it is of type double. F, L is applied only to

what is poiter

Question 1 What are the different steps in executing a C program? Explain Question 2 What are the commonly used input/output functions in C? How are they accessed?

How to insert values in array - c++ program: Write a program to insert values in array void main() { int a[2][3][2]={                                 {