Total Marks : 20View more random threads:
- CS408 Human computer Interaction Assignment NO 4 June 2012
- CS704 Assignment No. 01 Solution January 2016
- CS201 Introduction to Programming Assignment No 5 Solution...
- CS506 Web Design and Development Assignment No.1 Solution...
- CS302: Digital Logic Design assignment no 4 idea solution...
- cs507 idea solution second assignment fall 2010
- CS504 Software Engineering-1 assignment no 5 fall January...
- CS402 Theory of Automata Assignment No.4 Fall 2012 Due Date...
- CS410 Visual Programming Assignment no 1 spring fall 25...
- CS614 Data Warehousing Assignment No.4 Fall Semester 2013...
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.
Sponsored Links
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");