This code will produce hollow rectangles but I cannot put my head around where to insert or how to insert the border pieces.Code:#include <stdio.h> main (void) { //variables int width, height, thick, i, j; //user input printf("Enter the width of the rectangle.\n"); scanf("%d", &width); printf("Enter the height of the rectangle.\n"); scanf("%d", &height); printf("Enter the thickness of the rectangle's border.\n"); scanf("%d", &thick); //making the box top for(i = 0; i < width; i++) { printf("*"); } printf("\n"); // for(i = 0; i < (height-2); i++) { printf("*"); for(j = 0; j < (width-2); j++) { printf(" "); } printf("*"); printf("\n"); } //making the box bottom for(i = 0; i < width; i++) { printf("*"); } printf("\n"); system("PAUSE"); return 0; }
Very new to this so I am looking for code help as well as advice. Please do not just use logic.



LinkBack URL
About LinkBacks



