11-21-2012, 07:16 PM
Total Marks : 20
Due Date : 26-11-2012
Question 1: [20 Marks]
Write a C program that would draw the following shapes; rectangle, ellipse, circle and point in the following way as described below.
Rectangle:
Draw the rectangle as described in the figure below and the ellipse, circle and point should be drawn within the rectangle body.
Hint: Use the rectangle(x,y,a,b) function to draw the rectangle.
Ellipse:
Ellipse should be enclosed by the rectangle as described in the figure below.
Hint :Use the ellipse(x,y,startangle, endangle, semimajor, semiminor) function to draw the ellipse.
Circle:
Circle should be drawn with in the ellipse as described in the figure below.
Hint: Use the circle(x,y,radius) function to draw the circle.
Point:
Ellipse and circle should have common center and that center point should be displayed as a point.
Hint: Use the putpixel(x,y,colour) function to draw the point.
You can choose any colour for drawing rectangle, ellipse, circle and point; it can be of your own choice.
(Expected Output)
Note:
You can consult handouts of lecture 13 for help. You have to use Borlandc to run this program as
graphics.h is a borlnadc library. You can download borlandc setup from download section of cs602.
After installing Borlandc run BC.EXE.
Now Go to Options =>Linker =>Libraries
Press Alt + G
Press Alt +K
It will enable the graphics library. Now change following command in your program according to your installation.
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
For example:
initgraph(&gdriver, &gmode, "c:\\BorlandC\\bgi");
Due Date : 26-11-2012
Question 1: [20 Marks]
Write a C program that would draw the following shapes; rectangle, ellipse, circle and point in the following way as described below.
Rectangle:
Draw the rectangle as described in the figure below and the ellipse, circle and point should be drawn within the rectangle body.
Hint: Use the rectangle(x,y,a,b) function to draw the rectangle.
Ellipse:
Ellipse should be enclosed by the rectangle as described in the figure below.
Hint :Use the ellipse(x,y,startangle, endangle, semimajor, semiminor) function to draw the ellipse.
Circle:
Circle should be drawn with in the ellipse as described in the figure below.
Hint: Use the circle(x,y,radius) function to draw the circle.
Point:
Ellipse and circle should have common center and that center point should be displayed as a point.
Hint: Use the putpixel(x,y,colour) function to draw the point.
You can choose any colour for drawing rectangle, ellipse, circle and point; it can be of your own choice.
(Expected Output)
Note:
You can consult handouts of lecture 13 for help. You have to use Borlandc to run this program as
graphics.h is a borlnadc library. You can download borlandc setup from download section of cs602.
After installing Borlandc run BC.EXE.
Now Go to Options =>Linker =>Libraries
Press Alt + G
Press Alt +K
It will enable the graphics library. Now change following command in your program according to your installation.
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
For example:
initgraph(&gdriver, &gmode, "c:\\BorlandC\\bgi");
For Assignment Solution Call Now 0332-8775841 | VU Assignments Solutions | VU Quizzes | VU GDPS | VU Projects | VU Past Papers
