Sunday, 10 April 2016

Solution of homework 2

Write a C++ Program to print start on the screen.

Solution: 
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
void main()
{
int x1,x2,x3,x4,x5,y1,y2,y3,y4,y5;
cout<< "please enter 1st point coordinates";
cin>>x1>>y1;
cout<< "please enter 2nd point coordinates";
cin>>x2>>y2;
cout<< "please enter 3rd point coordinates";
cin>>x3>>y3;
cout<< "please enter 4th point coordinates";
cin>>x4>>y4;
cout<< "please enter 5th point coordinates";
cin>>x5>>y5;
int gd=DETECT, gm;
initgraph(&gd,&gm, "..\\bgi");
line(x1,y1,x2,y2); getch();
line(x3,y3,x4,y4); getch();
line(x3,y3,x5,y5); getch();
line(x1,y1,x4,y4); getch();
line(x2,y2,x5,y5); getch();
Output: 
















 

No comments:

Post a Comment