Please any one help me...........
#include<iostream.h>
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<CTYPE.H>
#include<LIMITS.H>
class network
{
/* request auto detection */
int gdriver, gmode;
int left, top, right, bottom;
int i,j;
// int isdigit(int i);
char ch;
public:
int ct,rg,s,nr;
//char ct1[];
int a,b;
int ct1,ct2,ct3,ct4;
void input()
{
cout<<"Enter your requirements: ";
cout<<"\n ";
cout<<"Enter the cost in between 10 to 300 thousands";
do
{
cout<<"\n Enter the cost";
cin>>ct;
if((ct<=10||ct>=300))
cout<<"\nINVALID INPUT!!";
}while((ct<=10||ct>=300));
cout<<"Enter range between 4 to 20 mbps";
do
{
cout<<"\n enter the range";
cin>>rg;
cin.ignore(INT_MAX,'\n');
if((rg<=4||rg>=20))
cout<<"\nINVALID INPUT!!";
}
while((rg<=4||rg>=20));
do
{
cout<<"\n1.Reliable 2.Nonreliable";
cin>>nr;
if(!(nr==1||nr==2))
cout<<"\nINVALID INPUT!!";
}
while(!(nr==1||nr==2));
do
{
cout<<"\n1.Security 2.No security";
cin>>s;
if(!(s==1||s==2))
cout<<"\nINVALID INPUT!!";
}
while(!(s==1||s==2));
}
};
class topology:public network
{
public:
void star();
void mesh();
void ring();
void bus();
void display();
};
void topology::star()
{
clrscr();/* draw a rectangle */
ct2=0;
if(ct<200)
ct2++;
if(rg<=10)
ct2++;
if(nr==1)
ct2++;
if(s==1)
ct2++;
cout<<"count2="<<ct2<<"\n";
}
void topology::mesh()
{
clrscr();/* draw a rectangle */
ct4=0;
if(ct<300)
ct4++;
if(rg<25)
ct4++;
if(nr==1)
ct4++;
if(s==1)
ct4++;
cout<<"count4="<<ct4<<"\n";
}
void topology::ring()
{
clrscr();/* draw a rectangle */
ct3=0;
if(ct<100)
ct3++;
if(rg<16)
ct3++;
if(nr==2)
ct3++;
if(s==2)
ct3++;
cout<<"count3="<<ct3<<"\n";
}
void topology::bus()
{
clrscr();/* draw a rectangle */
ct1=0;
if(ct<50)
ct1++;
if(rg<100)
ct1++;
if(nr==2)
ct1++;
if(s==2)
ct1++;
cout<<"count1="<<ct1<<"\n";
}
void topology::display(void)
{
if(ct1<ct2)
{
if(ct2<ct3)
{
if(ct3<ct4)
{
cout<<"\nMESH";
rectangle(180,130,220,180);
rectangle(330,130,370,180);
rectangle(180,280,220,330);
rectangle(330,280,370,330);
line(200,280,200,180);
line(350,280,350,180);
line(220,305,330,305);
line(220,155,330,155);
line(330,280,220,180);
line(220,280,330,180);
outtextxy(195,150,"D1");
outtextxy(340,150,"D2");
outtextxy(195,300,"D3");
outtextxy(340,300,"D4");
outtextxy(230,110,"MESH TOPOLOGY");
cout<<"\nCHARACTERISTICS OF MESH\n";
cout<<"\n1.cost=2 to 3 lakh \n2.range=10 to 25 mbps";
cout<<"\n3.It is reliable \n4.No security";
}
else
{
cout<<"\nRING";
rectangle(180,130,220,180);
rectangle(330,130,370,180);
rectangle(180,280,220,330);
rectangle(330,280,370,330);
circle(275,230,74);
outtextxy(195,150,"D1");
outtextxy(340,150,"D2");
outtextxy(195,300,"D3");
outtextxy(340,300,"D4");
outtextxy(230,110,"RING TOPOLOGY");
cout<<"\nCHARACTERISTICS OF RING\n";
cout<<"\n1.cost=50 to 100 thousands \n2.range=4 to 16 mbps";
cout<<"\n3.It is non-reliable \n4.No security";
}
}
else
{
if(ct2<ct4)
{
cout<<"\nMESH";
rectangle(180,130,220,180);
rectangle(330,130,370,180);
rectangle(180,280,220,330);
rectangle(330,280,370,330);
line(200,280,200,180);
line(350,280,350,180);
line(220,305,330,305);
line(220,155,330,155);
line(330,280,220,180);
line(220,280,330,180);
outtextxy(195,150,"D1");
outtextxy(340,150,"D2");
outtextxy(195,300,"D3");
outtextxy(340,300,"D4");
outtextxy(230,110,"MESH TOPOLOGY");
cout<<"\nCHARACTERISTICS OF MESH\n";
cout<<"\n1.cost=200 to 300 thousands \n2.range=10 to 25 mbps";
cout<<"\n3.It is reliable \n4.No security";
}
else
{
cout<<"\nSTAR";
rectangle(130,80,170,130);
rectangle(280,80,320,130);
rectangle(130,230,170,280);
rectangle(280,230,320,280);
rectangle(205,165,245,190); //center hub
line(280,231,245,191);
line(280,131,245,164);
line(205,165,170,131);
line(205,191,170,231);
outtextxy(215,175,"HUB");
outtextxy(145,103,"D1");
outtextxy(295,103,"D2");
outtextxy(145,253,"D3");
outtextxy(295,253,"D4");
outtextxy(175,50,"STAR TOPOLOGY");
cout<<"\nCHARACTERISTICS OF STAR\n";
cout<<"\n1.cost=100 to 200 thousands \n2.range=5 to 10mbps";
cout<<"\n3.It is reliable \n4.security";
}
}
}
else
{
if(ct1<ct3)
{
if(ct3<ct4)
{
cout<<"\nMESH";
rectangle(180,130,220,180);
rectangle(330,130,370,180);
rectangle(180,280,220,330);
rectangle(330,280,370,330);
line(200,280,200,180);
line(350,280,350,180);
line(220,305,330,305);
line(220,155,330,155);
line(330,280,220,180);
line(220,280,330,180);
outtextxy(195,150,"D1");
outtextxy(340,150,"D2");
outtextxy(195,300,"D3");
outtextxy(340,300,"D4");
outtextxy(230,110,"MESH TOPOLOGY");
cout<<"\nCHARACTERISTICS OF MESH\n";
cout<<"\n1.cost=200 to 300 thousands \n2.range=10 to 25 mbps";
cout<<"\n3.It is reliable \n4.No security";
}
else
{
cout<<"\nRING";
rectangle(180,130,220,180);
rectangle(330,130,370,180);
rectangle(180,280,220,330);
rectangle(330,280,370,330);
circle(275,230,74);
outtextxy(195,150,"D1");
outtextxy(340,150,"D2");
outtextxy(195,300,"D3");
outtextxy(340,300,"D4");
outtextxy(230,110,"RING TOPOLOGY");
cout<<"\nCHARACTERISTICS OF RING\n";
cout<<"\n1.cost=50 to 100 thousands \n2.range=4 to 16 mbps";
cout<<"\n3.It is non-reliable \n4.No security";
}
}
else
{
if(ct1<ct4)
{
cout<<"\nMESH";
rectangle(180,130,220,180);
rectangle(330,130,370,180);
rectangle(180,280,220,330);
rectangle(330,280,370,330);
line(200,280,200,180);
line(350,280,350,180);
line(220,305,330,305);
line(220,155,330,155);
line(330,280,220,180);
line(220,280,330,180);
outtextxy(195,150,"D1");
outtextxy(340,150,"D2");
outtextxy(195,300,"D3");
outtextxy(340,300,"D4");
outtextxy(230,110,"MESH TOPOLOGY");
cout<<"\nCHARACTERISTICS OF MESH\n";
cout<<"\n1.cost=2 to 3 lakh \n2.range=10 to 25 mbps";
cout<<"\n3.It is reliable \n4.No security";
}
else
{
cout<<"\nBUS";
outtextxy(230,110,"BUS TOPOLOGY");
rectangle(180,130,220,180);
rectangle(305,130,345,180);
rectangle(245,230,285,280);
rectangle(365,230,405,280);
line(155,205,430,205);
line(155,206,430,206);
line(155,207,430,207);
line(200,205,200,180);
line(265,205,265,230);
line(325,205,325,180);
line(385,205,385,230);
outtextxy(194,150,"D1");
outtextxy(318,150,"D2");
outtextxy(259,250,"D3");
outtextxy(379,250,"D4");
cout<<"\nCHARACTERISTICS OF BUS\n";
cout<<"\n1.cost=10 to 50 thousands \n2.range=10 to 100 mbps";
cout<<"\n3.It is non-reliable \n4.No security";
}
}
}
cout<<"\n-------USERS REQUIREMENT:-------";
cout<<"\nCOST= "<<ct<<" thousands";
cout<<"\nRANGE="<<rg<<" mbps";
if(nr==1)
cout<<"\nRELIABLE";
else
cout<<"\nNON-RELIABLE";
if(s==1)
cout<<"\nSECURITY";
else
cout<<"\nNO SECURITY";
cout<<"\ncount1: "<<ct1<<"\ncount2: "<<ct2;
cout<<"\ncount3: "<<ct3<<"\ncount4: "<<ct4;
}
int main(void)
{
/* request auto detection*/
int gdriver = DETECT, gmode, errorcode;
int left, top, right, bottom;
int i;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
setbkcolor(BLACK);
textcolor(BLACK);
clrscr();
cout<<"\n\t\t-----MINI PROJECT ON NETWORK TOPOLOGY-----\n";
setcolor(RED);
// clrscr();
topology a;
a.input();
a.bus();
a.star();
a.ring();
a.mesh();
a.display();
getch();
closegraph();
return 0;
}