How can draw a box in cprogram without using graphics.h
header file & using only one printf(); ?
Answer Posted / c.p.senthil
Generic Box routine,
to draw with prescribed length and width
// function defintion
void drawBox(int length, int width)
{
int i, j;
for(i=0; i<length; i++)
printf("_");
printf("\n");
for(j=0; j<width-1; j++)
{
printf("|");
for(i=0; i<(length-2); i++)
printf(" ");
printf("|");
printf("\n");
}
printf("|");
for(i=0; i<length-2; i++)
printf("_");
printf("|");
}
// function call
drawBox(30, 5);
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Differentiate between new and malloc(), delete and free() ?
i have a written test for microland please give me test pattern
What is memcpy() function?
Explain 'bus error'?
How is a macro different from a function?
how to write optimum code to divide a 50 digit number with a 25 digit number??
what do you mean by inline function in C?
Explain the use of bit fieild.
How do I use strcmp?
What is static memory allocation? Explain
What are the modifiers available in c programming language?
What standard functions are available to manipulate strings?
Do you have any idea how to compare array with pointer in c?
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
Explain the difference between ++u and u++?