Code for EXAMPLE OF WRITE FUNCTION in C++ Programming
# include <iostream.h>
# include <conio.h>
# include <string.h>
main()
{
char str[20];
clrscr();
cout<<"PLEASE ENTER THE STRING:->";
cin.getline(str,20);
int n=strlen(str);
for (int i=0;i<=n;i++)
{
cout.write(str,i);
cout<<"\n";
}
for(i=n;i>0;i--)
{
cout.write(str,i);
cout<<"\n";
}
}