here are some mods that work
# include <iostream.h>
# include <ctype.h>
int main()
{
char ch;
ch=cin.get();
do
{
switch(ch)
{
case 'A':
case 'a':
case ':':
{
// If colon
if(ch==':')
{
// change colon to period
cout<<". ";
// check to see if the next char is a space or character
if((ch=cin.peek())==32)
{
// Found white space ignore and get next character
cin.ignore();
ch=cin.get();
}
else
// Not a white space get next charater
ch=cin.get();
}
// check for the word "and"
if(ch=='a'||ch=='A')
{
if((ch=cin.get())=='n'||ch=='N')
if((ch=cin.get())=='d'||ch=='D')
{
// check for white space following "and"
if((ch=cin.peek())==32)
// If white space ignore
cin.ignore();
else
// character found insert space
cout<<" ";
}
}
// "and" deleted and/or next word capitalized
cout<<(ch=toupper(ch=cin.get()));
}
break;
default:
{ // print out every other leter
cout<<ch;
}
}// get next character
}while(ch=cin.get());
return 1;
}
|