hi
à à I hope the following modifications in ur code will solve ur problem.
#include<iostream.h>
#include<ctype.h>
void main()
{
à char ch, colon=':',tmp,tmp1,tmp2,tmp3;
à ch= cin.get();
à int i;
à while (ch!='\n')
à à {
à à if (ch == colon)
{
ch ='.';
cout<<ch;
ch=cin.get();
tmp=ch;
if (ch == 'a')
{
à ch=cin.get();
à tmp1=ch;
à if (ch=='n')
à {
à à ch=cin.get();
à tmp2=ch;
if (ch=='d')
à {
cin.ignore();/*if there is space after and use this line*/
à ch=cin.get();
à i=toupper(ch);
à ch=(char)(i);
à cout<<ch;
à à }
à else
à à {
à à à i=toupper(tmp);
à à à ch=(char)(i);
à à à cout<<ch;
à à à cout<<tmp1;
à à à cout<<tmp2;
à à }
à à }
à à else
à à {
i=toupper(tmp);
ch=(char)(i);
cout<<ch;
cout<<tmp1;
à à }
}
à à à else
à à à {
i=toupper(tmp);
ch=(char)(i);
cout<<ch;
}
}
à à else
à à à {
à cout<<ch;
à à à }
à à à ch=cin.get();
}
}
This is not the only solution..there may be many solutions better than this....
|