#include <iostream.h>
#include<conio.h>
void main( )
{
int i, j ,siz;
clrscr();
int G[100][100];
cout<<" Enter the size of sequre Metrix \n";
cout<<" Enter Rows siz :";
cin>>i;
cout<<" \n Enter Colums siz : " ;
cin>>j;
siz=j;
for(i=0 ; i < siz ; i++)
for(j=0 ; j< siz ; j++)
{
G[i][j]=0;
}
int a;
cout<<" \n Enter the No of Edges: ";
cin>>a;
cout<<" \n Enter the exact location where do you want make edge : "<<endl;
for (int j1=1 ; j1 <= a ; j1++)
{
cout<<" Enter Row Number :";
cin>>i;
cout<<" Enter colum Number : ";
cin>>j;
G[i][j]=1;
}
cout<< " Adjancy Matrix ";
for(i=0; i < siz; i++)
{
cout<< " \n ";
for( j=0; j < siz ; j++)
{
cout<<" "<< G[i][j];
}
cout<< " \n ";
}
getch();
}
#include<conio.h>
void main( )
{
int i, j ,siz;
clrscr();
int G[100][100];
cout<<" Enter the size of sequre Metrix \n";
cout<<" Enter Rows siz :";
cin>>i;
cout<<" \n Enter Colums siz : " ;
cin>>j;
siz=j;
for(i=0 ; i < siz ; i++)
for(j=0 ; j< siz ; j++)
{
G[i][j]=0;
}
int a;
cout<<" \n Enter the No of Edges: ";
cin>>a;
cout<<" \n Enter the exact location where do you want make edge : "<<endl;
for (int j1=1 ; j1 <= a ; j1++)
{
cout<<" Enter Row Number :";
cin>>i;
cout<<" Enter colum Number : ";
cin>>j;
G[i][j]=1;
}
cout<< " Adjancy Matrix ";
for(i=0; i < siz; i++)
{
cout<< " \n ";
for( j=0; j < siz ; j++)
{
cout<<" "<< G[i][j];
}
cout<< " \n ";
}
getch();
}
0 comments:
Post a Comment