We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

# CS602 Assignment No 01 Spring 2020 Solution & Discussion Due Date: 02-06-2020

CS602 Assignment No 01 Spring 2020 Solution & Discussion Due Date: 02-06-2020

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Views: 1407

### Replies to This Discussion

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided.

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Then copy Questions from assignment file and paste in Discussion.

http://bit.ly/vucodes (For Assignments, GDBs & Online Quizzes Solution)

http://bit.ly/papersvu (For Past Papers, Solved MCQs, Short Notes & More)

#include<stdio.h>
#include<conio.h>
#include<graphics.h> //how to add graphics library in dev c++
#include<math.h>
#include<iostream>
using namespace std;
// defining function of flood fill
void flood(int x, int y, int new_color, int old_color)
{
// check current pixel is old_color or not
if (getpixel(x, y) == old_color) {
// put new pixel with new color
putpixel(x, y, new_color);
// recursive call for bottom pixel fill
flood(x + 1, y, new_color, old_color);
// recursive call for top pixel fill
flood(x - 1, y, new_color, old_color);
// recursive call for right pixel fill
flood(x, y + 1, new_color, old_color);
// recursive call for left pixel fill
flood(x, y - 1, new_color, old_color);
}
}
// defining function of drawline
void drawline(int x0, int y0, int x1, int y1,int color)
{
int dx, dy, p, x, y;
dx=x1-x0;
dy=y1-y0;
x=x0;
y=y0;
p=2*dy-dx;
int col=color;
while(x<x1)
{
if(p>=0)
{
putpixel(x,y,col);
y=y+1;
p=p+2*dy-2*dx;
}
else
{
putpixel(x,y,col);
p=p+2*dy;
}
x=x+1;
}
}
//driver
int main(){
int gd, gm=DETECT, radius, x, y, font, font_dir, font_charsize;
initgraph(&gd, &gm, "");
//id display
//declaring parameters for printing id in program
font=8;
font_dir=0;
font_charsize=1;
//call function of printing text in graphic library
settextstyle(font,font_dir,font_charsize);
//call function for printing
x=10;
y=10;
outtextxy(x,y,"BC170000000");
//draw first circle
//initiating values to first circle
x=270;
y=330;
//call circle function to draw first circle
//call to fill circle and for giving color
flood(271,331,RED,0);
//draw second circle
//initiating values to second circle
x=320;
y=390;
//call circle function to draw second circle
//call to fill circle and for giving color
flood(321,391,GREEN,0);
//call draw line function
drawline(180,300,350,459, GREEN);
drawline(180,340,305,459, RED);
drawline(180,380,265,459, BLUE);
//draw rectangle
//initiating values to rectangle coordinates
int left, top, right, bottom;
left=180;
top=10;
right=440;
bottom=460;
//call rectangle function to draw rectangle
rectangle(left, top, right, bottom);
flood(260,260,WHITE,BLACK);

getch();
closegraph();
return 0;
}

********

#CS602 #Devc #graphics
CS602 Assignment No 01 Spring 2020 Solution

#CS602 #Devc++ #graphics
How to run graphics Program in dev C++ | Graphics in C++
CS602 Assignment No 01 Spring 2020 Solution

ABC is a well-known graphic designing industry famous for greeting card designs, logos and visiting
card designs. The company needs your services to write a code for following design for its client:

http://www.mediafire.com/file/f4g414oyfxye1ms/Dev_c%252B%252B.rar/file

http://www.mediafire.com/file/2hkun5p78gaph24/cs602.txt/file

#include<stdio.h>
#include<conio.h>
#include<graphics.h> //how to add graphics library in dev c++
#include<math.h>
#include<iostream>
using namespace std;
// defining function of flood fill
void flood(int x, int y, int new_color, int old_color)
{
// check current pixel is old_color or not
if (getpixel(x, y) == old_color) {
// put new pixel with new color
putpixel(x, y, new_color);
// recursive call for bottom pixel fill
flood(x + 1, y, new_color, old_color);
// recursive call for top pixel fill
flood(x - 1, y, new_color, old_color);
// recursive call for right pixel fill
flood(x, y + 1, new_color, old_color);
// recursive call for left pixel fill
flood(x, y - 1, new_color, old_color);
}
}
// defining function of drawline
void drawline(int x0, int y0, int x1, int y1,int color)
{
int dx, dy, p, x, y;
dx=x1-x0;
dy=y1-y0;
x=x0;
y=y0;
p=2*dy-dx;
int col=color;
while(x<x1)
{
if(p>=0)
{
putpixel(x,y,col);
y=y+1;
p=p+2*dy-2*dx;
}
else
{
putpixel(x,y,col);
p=p+2*dy;
}
x=x+1;
}
}
//driver
int main(){
int gd, gm=DETECT, radius, x, y, font, font_dir, font_charsize;
initgraph(&gd, &gm, "");
//id display
//declaring parameters for printing id in program
font=8;
font_dir=0;
font_charsize=1;
//call function of printing text in graphic library
settextstyle(font,font_dir,font_charsize);
//call function for printing
x=10;
y=10;
outtextxy(x,y,"BC170000000");
//draw first circle
//initiating values to first circle
x=270;
y=330;
//call circle function to draw first circle
//call to fill circle and for giving color
flood(271,331,RED,0);
//draw second circle
//initiating values to second circle
x=320;
y=390;
//call circle function to draw second circle
//call to fill circle and for giving color
flood(321,391,GREEN,0);
//call draw line function
drawline(180,300,350,459, GREEN);
drawline(180,340,305,459, RED);
drawline(180,380,265,459, BLUE);
//draw rectangle
//initiating values to rectangle coordinates
int left, top, right, bottom;
left=180;
top=10;
right=440;
bottom=460;
//call rectangle function to draw rectangle
rectangle(left, top, right, bottom);
flood(260,260,WHITE,BLACK);
getch();
closegraph();
return 0;
}

#CS602assignment1solution2020
CS602 assignment 1 SOLUTION spring 2020 Correct solved Complete

CS602 Assignment 1 Complete Solution Spring 2020,CS602 Assignment 1 Complete Solution,CS602 Assignment 1,CS602,CS602 assignment 1 solution,CS602 assignment spring 2020,CS602 assignment solution spring 2020,CS602 assignment, assignment 1 CS602 solution, solution CS602 assignment 1, CS602 assignment 1 solution 2020,CS602 assignment solution 2020,CS602 assignment 1,CS602 assignment 1 solution spring 2020,CS602 assignment no 1 solution spring 2020,CS602 assignment no 1 solution 2020,CS602 1st assignment solution 2020,CS602 1st assignment solution,CS602 1st assignment solution spring 2020,assignment solution spring 2020,CS602 Assignment 1 Complete Solution Spring 2020,CS602 Assignment 1 Complete Solution,CS602 Assignment 1,CS602,CS602 assignment 1 solution,CS602 assignment spring 2020,CS602 assignment solution spring 2020,CS602 assignment, assignment 1 CS602 solution, solution CS602 assignment 1 CS602
#CS602assignment1solution2020

CS602 Computer Graphics Assignment 1 Solution & Discussion Spring 2020

Solution idea CS602:

`#include<stdio.h>#include<conio.h>#include<graphics.h> //how to add graphics library in dev c++#include<math.h>#include<iostream>using namespace std;    // defining function of flood fill              void flood(int x, int y, int new_color, int old_color)              {              // check current pixel is old_color or not              if (getpixel(x, y) == old_color) {                           // put new pixel with new color              putpixel(x, y, new_color);                           // recursive call for bottom pixel fill              flood(x + 1, y, new_color, old_color);                           // recursive call for top pixel fill              flood(x - 1, y, new_color, old_color);                           // recursive call for right pixel fill              flood(x, y + 1, new_color, old_color);                           // recursive call for left pixel fill              flood(x, y - 1, new_color, old_color);              }}// defining function of drawline              void drawline(int x0, int y0, int x1, int y1,int color)              {              int dx, dy, p, x, y;              dx=x1-x0;              dy=y1-y0;              x=x0;              y=y0;              p=2*dy-dx;              int col=color;              while(x<x1)              {                             if(p>=0)                             {                                           putpixel(x,y,col);                                           y=y+1;                                           p=p+2*dy-2*dx;                             }                             else                             {                                           putpixel(x,y,col);                                           p=p+2*dy;                             }              x=x+1;              }}//driverint main(){              int gd, gm=DETECT, radius, x, y, font, font_dir, font_charsize;              initgraph(&gd, &gm, "");//id display              //declaring parameters for printing id in program              font=8;              font_dir=0;              font_charsize=1;                           //call function of printing text in graphic library              settextstyle(font,font_dir,font_charsize);              //call function for printing              x=10;              y=10;              outtextxy(x,y,"BC170000000");//draw first circle              //initiating values to first circle              x=270;              y=330;              radius=40;                                          //call circle function to draw first circle              circle(x,y,radius);                           //call to fill circle and for giving color              flood(271,331,RED,0);//draw second circle              //initiating values to second circle              x=320;              y=390;              radius=30;                           //call circle function to draw second circle              circle(x,y,radius);                           //call to fill circle and for giving color              flood(321,391,GREEN,0);                           //call draw line function              drawline(180,300,350,459, GREEN);              drawline(180,340,305,459, RED);              drawline(180,380,265,459, BLUE);//draw rectangle              //initiating values to rectangle coordinates              int left, top, right, bottom;              left=180;              top=10;              right=440;              bottom=460;                           //call rectangle function to draw rectangle              rectangle(left, top, right, bottom);              flood(260,260,WHITE,BLACK);                           getch();              closegraph();              return 0;}`
#include<stdio.h>
#include<conio.h>
#include<graphics.h> //how to add graphics library in dev c++
#include<math.h>
#include<iostream>
using namespace std;
// defining function of flood fill
void flood(int x, int y, int new_color, int old_color)
{
// check current pixel is old_color or not
if (getpixel(x, y) == old_color) {
// put new pixel with new color
putpixel(x, y, new_color);
// recursive call for bottom pixel fill
flood(x + 1, y, new_color, old_color);
// recursive call for top pixel fill
flood(x - 1, y, new_color, old_color);
// recursive call for right pixel fill
flood(x, y + 1, new_color, old_color);
// recursive call for left pixel fill
flood(x, y - 1, new_color, old_color);
}
}
// defining function of drawline
void drawline(int x0, int y0, int x1, int y1,int color)
{
int dx, dy, p, x, y;
dx=x1-x0;
dy=y1-y0;
x=x0;
y=y0;
p=2*dy-dx;
int col=color;
while(x<x1)
{
if(p>=0)
{
putpixel(x,y,col);
y=y+1;
p=p+2*dy-2*dx;
}
else
{
putpixel(x,y,col);
p=p+2*dy;
}
x=x+1;
}
}
//driver
int main(){
int gd, gm=DETECT, radius, x, y, font, font_dir, font_charsize;
initgraph(&gd, &gm, "");
//id display
//declaring parameters for printing id in program
font=8;
font_dir=0;
font_charsize=1;
//call function of printing text in graphic library
settextstyle(font,font_dir,font_charsize);
//call function for printing
x=10;
y=10;
outtextxy(x,y,"BC170000000");
//draw first circle
//initiating values to first circle
x=270;
y=330;
//call circle function to draw first circle
//call to fill circle and for giving color
flood(271,331,RED,0);
//draw second circle
//initiating values to second circle
x=320;
y=390;
//call circle function to draw second circle
//call to fill circle and for giving color
flood(321,391,GREEN,0);
//call draw line function
drawline(180,300,350,459, GREEN);
drawline(180,340,305,459, RED);
drawline(180,380,265,459, BLUE);
//draw rectangle
//initiating values to rectangle coordinates
int left, top, right, bottom;
left=180;
top=10;
right=440;
bottom=460;
//call rectangle function to draw rectangle
rectangle(left, top, right, bottom);
flood(260,260,WHITE,BLACK);
getch();
closegraph();
return 0;
}

the code is not running its showing errors

initgraph(&gd, &gm, "");

this line shows error

i have corrected that line and also further but output shows a rectangular and ID on top left

# Computer graphics cs602 assignment #01 solution with code 100% correct

In this video we discuss the cs602 assignment #1 spring 2020. how to draw a circle in dev c++. How to provide lib files. How to create first project of graphics and run in dev c++. If you think my videos are informative then please likes my videos, comments and shares thanks.

how to add grphics in dev c++?
watch this video
https://youtu.be/0SnPS9iAjFg

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <graphics.h>
#include <math.h>
int main()
{
int gd=DETECT, gm;
initgraph(&gd,&gm,(char*)" ");
setcolor(WHITE);//set text color
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);// set font style
outtextxy(20, 30, (char*)"bc1507401247"); // write your student id

setcolor(BLUE);// set color
rectangle(150,100,600,600); //draw main rectangle
setfillstyle(SOLID_FILL,WHITE);// fill color
floodfill(151,101,BLUE); //fill rectangle with color

setcolor(CYAN);// set color
circle(390,360,60);//draw cricle 1
setfillstyle(SOLID_FILL,CYAN);// fill color
floodfill(390,360,CYAN);// fill color

setcolor(GREEN);// set color
circle(475,430,40);//draw cricle 2
setfillstyle(SOLID_FILL,GREEN);// fill color
floodfill(475,430,GREEN);// fill color

setcolor(BLUE);// set color
line(150,300,600,550); //line 1 inside main rectangle
setfillstyle(SOLID_FILL,BLUE);// fill color

setcolor(CYAN);// set color
line(150,350,600,600); // line 2 inside main rectangle
setfillstyle(SOLID_FILL,CYAN);// fill color

setcolor(RED);// set color
line(150,400,500,600); //line 3 inside main rectangle
setfillstyle(SOLID_FILL,RED);// fill color

getch();
closegraph();
}

## Latest Activity

14 minutes ago
22 minutes ago
+!!! Walker'\$ Inception!!! liked ARhum's discussion Poetry...!!!
24 minutes ago
+M.Tariq Malik liked CristinaPerry's discussion Organic Carpet Cleaning
33 minutes ago
Muskan Ch updated their profile
50 minutes ago
Jimmy007 updated their profile
1 hour ago
CristinaPerry posted a discussion

1 hour ago

1

2

3

## HELP SUPPORT

This is a member-supported website. Your contribution is greatly appreciated!