So idk why I cant edit the post anymore so...
Code:
#include <stdio.h>
//Function Prototype
void PrintBox(int width, int height, char boxChar);
void PrintChars(int height, char boxChar);
//Main Function
int main(void)
{
//Local Variables
auto int width;
auto int height;
auto char boxChar;
auto int result;
//Prompt user for width inputs and checks for invalid parameters or EOF
printf("%s", "Please enter a positive box width: ");
result = scanf("%d", &width);
if(result != 1)
{
puts("Error no width was entered..");
return 0;
}
else if(width > 80 || width < 1)
{
puts("Sorry, the width must be between 1 and 80 inclusive...");
return 0;
}
//Prompt user for height and checks for invalid parameters or EOF
printf("%s", "Please enter a positive box height: ");
result = scanf("%d", &height);
if(result != 1)
{
puts("Error no height was entered..");
return 0;
}
else if (height > 80 || height < 1)
{
puts("Sorry, the height must be between 1 and 80 inclusive...");
return 0;
}
//Prompt user for box char and checks for invalid parameters of EOF
printf("%s", "Please enter the box character: ");
result = scanf(" %c", &boxChar);
if(result != 1)
{
puts("Error! No character was entered...");
return 0;
}
else if(result = 1)
{
PrintBox(width, height, boxChar);
}
}
//Functions
void PrintBox(int width, int height, char boxChar)
{
for(int j = 0; j < height; j++)
{
for(int i = 0; i < width; ++i)
{
PrintChars(i, boxChar);
}
}
//PrintChars(height, boxChar);
}
void PrintChars(int boxNumber, char boxChar)
{
//Print the width of box
printf("%c", boxChar);
printf("\n");
/*for(int i = 1; i <= boxNumber; ++i)
{
printf("%c\n", boxChar);
}
*/
}
P.S. Ty Salem