"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain

Thursday, January 21, 2010

Abbreviation

/*  The program can convert an extended term into its abbreviation.
eg -> Central Processing Unit : C P U
          World Wide Web : W W W   */

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>


void main()
{
char text[40], abbre[10];
int i;


cout<<"\n Enter the String (extended term):";
gets(text);


for( i = 0; text[i] ! = '\0' ; i++)
 if(text[i] = = ' ' )
   { strcpy(abbre, str[i+1]);
      strcpy(abbre, " ");
    }




cout<< text << " can be abbreviated into " << abbre;
getch();
}

No comments:

Post a Comment

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Now Playing: Ballade Pour Adeline

About Me

My photo
I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.