CS602 Assignment Solution Fall 2019
#1
CS602 Assignment Solution Fall 2019


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <graphics.h> //graphics header file
#include <math.h>
int main()
{
int gd=DETECT, gm;
initgraph(&gd,&gm,(char*)" ");
setcolor(WHITE);
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
outtextxy(10, 20, (char*)"BC170403596"); //your VU-ID
//variables
int x1=150;
int y1=100;
int x2=x1*4;
int y2=y1*5;
int p=x1*2;
int q=x1*3;
int r=y1*2;
int s=y1*3;
int t=y1*4;
setcolor(YELLOW);
rectangle(x1,y1,x2,y2); //draws main rectangle
setfillstyle(SOLID_FILL,LIGHTBLUE);
floodfill(151,101,YELLOW); //fill rectangle with LIGHT BLUE COLOR
line(p,y1,p,y2); //vertical line 1 inside main rectangle
line(q,y1,q,y2); //vertical line 2 inside main rectangle
line(x1,r,x2,r); //horizontal line 1 inside main rectangle
line(x1,s,x2,s); //horizontal line 2 inside main rectangle
line(x1,t,x2,t); //horizontal line 3 inside main rectangle
//row 1 rectangles
rectangle(x1+10,y1+10,p-10,r-10);
rectangle(p+10,y1+10,q-10,r-10);
rectangle(q+10,y1+10,x2-10,r-10);
//row 2 rectangles
rectangle(x1+10,r+10,p-10,s-10);
rectangle(p+10,r+10,q-10,s-10);
rectangle(q+10,r+10,x2-10,s-10);
//row 3 rectangles
rectangle(x1+10,s+10,p-10,t-10);
rectangle(p+10,s+10,q-10,t-10);
rectangle(q+10,s+10,x2-10,t-10);
//row 4 rectangles
rectangle(x1+10,t+10,p-10,y2-10);
rectangle(p+10,t+10,q-10,y2-10);
rectangle(q+10,t+10,x2-10,y2-10);
//row 1 circles
circle(x1+75,y1+50,30);
circle(p+75,y1+50,30);
circle(q+75,y1+50,30);
//row 2 circles
circle(x1+75,r+50,30);
circle(p+75,r+50,30);
circle(q+75,r+50,30);
//row 3 circles
circle(x1+75,s+50,30);
circle(p+75,s+50,30);
circle(q+75,s+50,30);
//row 4 circles
circle(x1+75,t+50,30);
circle(p+75,t+50,30);
circle(q+75,t+50,30);
setfillstyle(SOLID_FILL,BLACK); //fills black color in all inside rectangles
setfillstyle(CLOSE_DOT_FILL,WHITE); //fills 1st row of rectangles with close_dots
floodfill(x1+11,y1+11,YELLOW);
floodfill(p+11,y1+11,YELLOW);
floodfill(q+11,y1+11,YELLOW);
setfillstyle(SLASH_FILL,WHITE); //fill 2nd row of rectangles with slash lines
floodfill(x1+11,r+11,YELLOW);
floodfill(p+11,r+11,YELLOW);
floodfill(q+11,r+11,YELLOW);
setfillstyle(BKSLASH_FILL,WHITE); //fills 3rd row of rectangles with back slash lines
floodfill(x1+11,s+11,YELLOW);
floodfill(p+11,s+11,YELLOW);
floodfill(q+11,s+11,YELLOW);
setfillstyle(WIDE_DOT_FILL,WHITE); //fills 4th row of rectangles with wide_dots
floodfill(x1+11,t+11,YELLOW);
floodfill(p+11,t+11,YELLOW);
floodfill(q+11,t+11,YELLOW);
setfillstyle(SOLID_FILL,MAGENTA); //fills all circles with magenta color
floodfill(x1+76,y1+51,YELLOW);
floodfill(p+76,y1+51,YELLOW);
floodfill(q+76,y1+51,YELLOW);
floodfill(x1+76,r+51,YELLOW);
floodfill(p+76,r+51,YELLOW);
floodfill(q+76,r+51,YELLOW);
floodfill(x1+76,s+51,YELLOW);
floodfill(p+76,s+51,YELLOW);
floodfill(q+76,s+51,YELLOW);
floodfill(x1+76,t+51,YELLOW);
floodfill(p+76,t+51,YELLOW);
floodfill(q+76,t+51,YELLOW);
getch();
closegraph();
}
  


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS614 Assignment 2 Solution Fall 2019 Ayra Suleman 0 127 11-28-2019, 11:41 PM
Last Post: Ayra Suleman
  CS614 Assignment Solution Fall 2019 Ayra Suleman 0 119 11-26-2019, 11:39 PM
Last Post: Ayra Suleman
  CS601 Assignment 2 Solution Fall 2019 Ayra Suleman 0 115 11-26-2019, 11:37 PM
Last Post: Ayra Suleman
  CS625 Assignment Solution Fall 2019 Ayra Suleman 0 138 11-24-2019, 03:11 AM
Last Post: Ayra Suleman
  CS605 Assignment Solution Fall 2019 Ayra Suleman 0 141 11-20-2019, 11:09 PM
Last Post: Ayra Suleman
  CS604 Assignment Solution Fall 2019 Ayra Suleman 0 227 11-17-2019, 02:06 PM
Last Post: Ayra Suleman
  CS601 Assignment 1 Solution Fall-2019 Ayra Suleman 0 166 11-15-2019, 03:09 AM
Last Post: Ayra Suleman
  CS610 Assignment 1 Solution Fall 2019 Ayra Suleman 0 167 11-11-2019, 02:01 AM
Last Post: Ayra Suleman
  CS609 Assignment 1 Solution Fall 2019 Ayra Suleman 0 120 11-11-2019, 01:42 AM
Last Post: Ayra Suleman
  CS609 GDB Solution Spring 2019 Ayra Suleman 0 814 08-10-2019, 01:20 AM
Last Post: Ayra Suleman



Users browsing this thread:
1 Guest(s)