net.cpp

Description:          This program is Menu driven program for Creating/deleting inodes and connection in the Graphs.

 

Platform Used:      g++ (GNU C++, a freely redistributable C++ compiler).
 

/*net.cpp*/

#include
#include "help.h"
using namespace std;

int main()
{
graph g;
int x,choice,l, y,m,n,d,c;;
static int count;
do
{
choice=g.displaymenu();
switch(choice)
{
case 1:x=++count;
g.adb(g.p,x);
cout<<"\nId of the Last node added is "<>x;
cout<<"to: "; cin>>y;
if(x>count||y>count)
{
cout<<"Nodes not Available"; cout<<"\nPlease Re-enter!"; break; } cout<<"Enter the cost: "; cin>>c;
g.search(g.p,x,y,c);
g.search(g.p,y,x,c);
break;
case 3:cout<<"\n"<<"Delete node no# "; cin>>d;
g.delnode(g.p,d);
break;
case 4:cout<<"Disconnect: "; cin>>m;
cout<<"From: "; cin>>n;
g.disconn(g.p,m,n);
g.disconn(g.p,n,m);
break;
case 5:g.display(g.p);
break;
case 6:break;
default:cout<<"Invalid choice"; } }while(choice!=6); return 0; }

 

Rate this post

Leave a Reply