How can draw a box in cprogram without using graphics.h
header file & using only one printf(); ?
Answers were Sorted based on User's Feedback
Answer / chandan kumar r
#include<stdioh>
#include<conio.h>
void main()
{
printf("______________\n|______________|\n");
getch();
}
output:
____________________
|____________________|
| Is This Answer Correct ? | 37 Yes | 9 No |
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 |
Answer / veeramalliga
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("\n----------------\n");
printf("\n| |\n");
printf("\n| |\n");
printf("\n-----------------\n");
getch();
}
| Is This Answer Correct ? | 1 Yes | 8 No |
What is character set?
how many keywords are available in 'c' language a) 32 b) 34 c) 45 d) 48
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
why TCS selected more student in the software field from all institution.
Can we change the value of #define in c?
What is 1d array in c?
What is self-referential structure in c programming?
Explain what is the difference between far and near ?
What is && in c programming?
I came across some code that puts a (void) cast before each call to printf. Why?
Write a program to show the change in position of a cursor using c
int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above