I'm working on a program that has you enter your name, and the program then puts it into a square. For example, for the input "Zyad"
I would expect the output:
********
| |
| Zyad |
| |
********
Now I want to be able to enter two names (for example first and last name) and get the same sort of output.
The input of "Zyad Sabry"
would yield
**************
| |
| Zyad Sabry |
| |
**************
My Code :
scanf("%s",name);
n = strlen(name);
printf(" ");
for(i=0;i<n+4;i++)
printf("*");
printf("\n");
printf("|");
for(i=0;i<n+4;i++)
printf(" ");
printf("|");
printf("\n");
printf("|");
for(i=0;i<(n+4)-n-2;i++)
printf(" ");
printf("%s |");
printf("\n");
printf("|");
for(i=0;i<n+4;i++)
printf(" ");
printf("|");
printf("\n");
printf(" ");
for(i=0;i<n+4;i++)
printf("*");