#include <iostream.h>
#include <conio.h>
/* Default
indent to -1. This value tells the function
to reuse the
previous value. */
void iputs(char *str, int indent
= -1);
int main()
{
clrscr();
iputs("Hello there",
10);
iputs("This will be indented
10 spaces by default");
iputs("This will be indented 5
spaces", 5);
iputs("This is not
indented", 0);
getch();
return 0;
}
void iputs(char *str, int
indent)
{
static i = 0; // holds previous indent value
if(indent >= 0)
i = indent;
else //
reuse old indent value
indent = i;
for( ; indent; indent--) cout
<< " ";
cout << str << "\n";
}