Write a program that displays the outline of a box five characters wide and five characters tall. Use the ‘*’ character for the box outline.
here are my codes:

#include <stdio.h>
#include <stdlib.h>
int main()
    printf("%c\v", '*');
    printf("%c\v", '*');
    printf("%c\v", '*');
    printf("%c\v", '*');

    printf("%c\n", '*');
    printf("%c%8c\n", '*','*');
    printf("%c%8c\n", '*','*');
    printf("%c%8c\n", '*','*');

    printf("%c\v", '*');
    printf("%c\v", '*');
    printf("%c\v", '*');
    printf("%c\v", '*');
    printf("%c\v\n", '*');
    return (0);

still it works fine, i can see the outline of the box but together with the character '*' there is an another character annoying me and i dn't know how to remove it. it resembles like the gender symbol for males.

5 Years
Discussion Span
Last Post by Adak

Instead of explicitly printing every every * with another line of code, you want to use loops and if statements, etc.

Think more like this, in pseudo code:

get the height and the width of the box, from the user
for each row
   move the cursor along the width of the box
   for each column    
      if the column number is the first, or the last one, 
         print a *

      if the row number is the top or the bottom
         print every column with a *
    next column
    print newline
next row    
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.