Friday, 8 May 2009

Get the abbreviated form

Description:-
If u tired to make ur name in the abbreviated form here is the simple solution of this problem. Through this program u can convert any English name into the abbreviated format. For example if ur name is "Santanu biswas" then the program returns "S biswas"; also if your name is "Sunil kumar ghosh" then the program returns "S k ghosh".

Process:-
1. Copy the entire source code(Bold in format).
2. Paste that in your c or c++ compiler.
3. Save that with a suitable name.
4. Compile that program.
5. Finally run that program.

Error handling:-
Due to inappropiate html coding done by this web page I can't give the header file
name like stdio.h, conio.h, stdlib.h, iostream.h, fstream.h, iomanip.h etc.
If u get an error report after compiling the program
"CALL TO UNDEFINED FUNCTION 'PRINTF(OR ANYTHING)' IN FUNCTION MAIN()"
please add the above mentioned header file after #include
like #include.

Disclaimer:-
If you have any other problem regarding the program please mail me.
My mail address is showing on my blog page.



Source code:-

#include
#include
void main()
{
int i,n,len;
char name[50];
printf("Enter the name(Firstname Middlename Lastname)=>");
gets(name);
len=strlen(name);
n=len-1;
while(name[n]!=' ')
n--;
for(i=0;i {
if(i==0)
printf("%c ",name[i]);
else if(name[i]==' ')
printf("%c ",name[i+1]);
}
for(i=n+1;i printf("%c",name[i]);
}

0 comments: