#include <iostream.h>
#include <conio.h>
#include <stdio.h>
void main(void)
{
int flag = 1, letter = 0;
char c, period = '.', blank = ' ';
cout<<"plese enter a sentance finish with period"<<'\n';
while((c=getchar())!=period)
{
if(c==blank)
{
if(flag)
{
cout<<"*";
flag=0;
}
}
else
{
letter++;
cout<<c;
flag=1;
}
}
cout<<endl<<"Number of letter is "<<letter;
getch();
}
|