B
blackneos940
Guest
I got this Block of Code from that book I was told about..... 
Um.... Also, I removed all instances of "void", as I was told by someone here that "void" is bad practice or something.......
It seemed to work fine, and I THINK I get the gist of the Code, but..... If I put 'display ("Hello World!!")', then it doesn't work.....
Why.......? Thank you for any help guys.... :3

Code:
/*Showchar.c -- prints characters in rows and columns*/
#include <stdio.h>
display(char cr, int lines, int width);
int main()
{
int ch; /*Character to be printed*/
int rows, cols; /*Number of rows and columns*/
printf ("Enter a character and two integers:\n>>> ");
while ((ch = getchar()) != '\n')
{
if (scanf("%d %d", &rows, &cols))
break;
display(ch, rows, cols);
while (getchar() != '\n')
continue;
printf ("Enter another character and two integers;\n");
printf ("Enter a newline to quit.\n");
}
printf ("Bye.\n");
return 0;
}
display(char cr, int lines, int width)
{
int rows, col;
for (rows = 1; rows <= lines; rows++)
{
for (col = 1; col <= width; col++)
putchar(cr);
putchar('\n'); /*End line and start a new one*/
}
}
Um.... Also, I removed all instances of "void", as I was told by someone here that "void" is bad practice or something.......

