#include <iostream>
#include <conio>
void print(int[][100],int);
void p();
int v,i,j,e[100][100];
char ch;
int main()
{
p();
cout<<"\n\nPlease enter the number of V:";
cin>>v;
while(1)
{
clrscr();
p();
cout<<"\n\nWhat do you want to do?\n\n";
cout<<"1-Insert a new Yal\n2-Delete a Yal\n3-Print Graph\n4-Exit\n\n";
cout<<"What is Your selection:";
cin>>ch;
switch(ch)
{
case'1':
clrscr();
p();
cout<<"\n\nplease enter Yal:";
cin>>i>>j;
if(i>v||j>v)
{
cout<<"\n\nWarning!!! you must enter two number betwen 0-"<<v;
getch();
}
else
e[i][j]=1;
break;
case'2':
clrscr();
p();
print(e,v);
cout<<"\n\nplease enter your Deleted Yal:";
cin>>i>>j;
e[i][j]=0;
break;
case'3':
print(e,v);
getch();
break;
case'4':return 0;
}
}
getch();
return 0;
}
//*********************************************************
void print(int graph[][100],int v)
{
int i,j;
clrscr();
p();
cout<<"\n";
for(i=0;i<v;i++)
{
cout<<i<<" ";
for(j=0;j<v;j++)
{
cout<<graph[i][j]<<" ";
}
cout<<"\n";
}
cout<<"\n ";
for(i=0;i<v;i++)
cout<<i<<" ";
cout<<"\n\nV(G)={";
for(i=0;i<v;i++)
{
cout<<i;
if(i<v-1)
cout<<",";
}
cout<<"}";
cout<<"\n\nE(G)={";
for(i=0;i<v;i++)
{
for(j=0;j<v;j++)
{
if(graph[i][j]==1)
cout<<"("<<i<<","<<j<<")";
}
}
cout<<"}";
}
//*********************************************************
void p()
{
gotoxy(55,23);
gotoxy(1,1);
}