-
screen formating
Here is a stupid question. I have to do some formating for a program. With this formating i need to make a box out these symbles ----------- Depending on how big the box is the number of dashes. I can i make the box grow and shrink depending the data in the box. I can get the side to work but not the top or botom line. Is there some format function that you can just multiple the single - (dash) to the number of charactors going into the box?
Thanks
chris
-
-
Well, it all depends on your data. Of course, you'll want to use a loop and then stop and the data specification. Example:
Code:
char string[10];
int numtimes, i;
printf("Enter how big the box is in length: ");
fgets(string, sizeof(string), stdin); // get string from std input
sscanf(string, "%d", &numtimes); // put int value into numtimes
for (i = 0, i < numtimes; i++)
{
printf("|\n");
}
I haven't tested the code, but logically that will work.
--Garfield
BTW If you really want to get into visual programming, learn to program Windows (preferable with petzold).