writing names in short

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
char ch[40],req[40];
int ctr=0,c=0,k=0;
gets(ch);

int i=0;
while(ch[i]!=”)
{
if(ch[i]==’ ‘)
{
ctr++;
}
i++;
}

for (int j=0;ch[j]!=”;j++)
{
if(ch[j]==’ ‘)
{
c++;
if(c!=ctr)
{
req[k]=ch[j+1];
k++;
req[k]=’.’;
k++;
req[k]=’ ‘;
k++;
}
else
{
while(ch[j]!=”)
{
req[k]=ch[j];
k++;
j++;
}
}
}
}

req[k+1]=”;

puts(req);

getch();

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s