Posts

Showing posts from September, 2018

Program to draw a star using DDA Line Drawing Algorithm in C++

Image
#include <iostream> #include <graphics.h> using namespace std; void star(float,float,float,float); int main() {     int i,gd=DETECT,gm;     char path[] = "";     initgraph(&gd,&gm,path);     //Statically setted  coordinates     star(300,200,200,400);     star(200,400,400,400);     star(300,200,400,400);     star(200,250,400,250);     star(200,250,300,450);     star(400,250,300,450);     getch();     closegraph(); } //Function to draw a star void star(float x1,float y1,float x2,float y2) {     float x,y,dx,dy,step;     int i;     dx=(x2-x1);     dy=(y2-y1);     if(dx>=dy)     {         step=abs(dx);     }     else     {        step=abs(dy);     }     dx=dx/s...

Program for DDA Line Drawing Algorithm in C++

Image
//This code is tested in Code Blocks #include <iostream> #include <graphics.h> using namespace std; void dda(float,float,float,float); int main() {     float x1,y1,x2,y2;     cout<<"Enter the value of x1 and y1 : ";     cin>>x1>>y1;     cout<<"Enter the value of x2 and y2: ";     cin>>x2>>y2;     dda(x1,y1,x2,y2); } void dda(float x1,float y1,float x2,float y2) {     float x,y,dx,dy,step;     int i,gd=DETECT,gm;     char path[] = "";     initgraph(&gd,&gm,path);     dx=x2-x1;     dy=y2-y1;     if(dx>=dy)     {         step=abs(dx);     }     else     {        step=abs(dy);     }     dx=dx/step;     dy=dy/step;     x=x1;     y=y1;   ...

HOW TO SETUP CODE BLOCKS FOR GRAPHICS PROGRAMS

Image
How to setup... Download Code::Blocks from  here . You have to download the codeblocks-17.12mingw-setup.exe or codeblocks-17.12mingw nosetup.zip file. The first file(highlighted) is the install-able setup and the other one(highlighted) is portable zip file(not need to install). If you are beginners you prefer the first one. After the installation you locate the code blocks at location C:\Program Files (x86)\CodeBlocks or at C:\Program Files\CodeBlocks. You have to download the graphics file from this link  . Extras this zip file, it includes three files (two header files & a library file).   Now copy the graphics.h & winbgim.h header files and paste at location C:\Program Files (x86)\CodeBlocks\MinGW\include And copy the libbgi.a file at location C:\Program Files (x86)\CodeBlocks\MinGW\lib Now open the code blocks and follow the steps: 1. Left click on "Settings (menu item)" in "Start here - Code::B...

INTELLIGENT AGENTS

Image
First of all we have to know that an environment influence the design of the suitable agents for that environment. Agent:             An agent is anything that can be viewed as perceiving its environment through sensors and acting upon that environment through actuators.