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
  CS605 Assignment 3 Solution Fall 2020 Ayra Suleman 0 1,341 01-26-2020, 02:53 AM
Last Post: Ayra Suleman
  CS606 Assignment 3 Solution Fall 2020 Ayra Suleman 0 1,294 01-26-2020, 02:46 AM
Last Post: Ayra Suleman
  CS602 Assignment 3 Solution Fall 2020 Ayra Suleman 0 783 01-26-2020, 02:18 AM
Last Post: Ayra Suleman
  CS604 Assignment 3 Solution Fall 2020 Ayra Suleman 0 756 01-26-2020, 02:16 AM
Last Post: Ayra Suleman
  CS614 GDB Idea Solution Fall 2020 Ayra Suleman 0 941 01-16-2020, 10:36 PM
Last Post: Ayra Suleman
  CS601 Assignment 3 Solution Fall 2020 Ayra Suleman 0 1,712 01-16-2020, 10:32 PM
Last Post: Ayra Suleman
  CS614 Assignment 2 Solution Fall 2019 Ayra Suleman 0 848 11-28-2019, 11:41 PM
Last Post: Ayra Suleman
  CS614 Assignment Solution Fall 2019 Ayra Suleman 0 744 11-26-2019, 11:39 PM
Last Post: Ayra Suleman
  CS601 Assignment 2 Solution Fall 2019 Ayra Suleman 0 755 11-26-2019, 11:37 PM
Last Post: Ayra Suleman
  CS625 Assignment Solution Fall 2019 Ayra Suleman 0 579 11-24-2019, 03:11 AM
Last Post: Ayra Suleman



Users browsing this thread:
2 Guest(s)