Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Matricea Tranzitiilor
Language: C/C++
Code:
#include <iostream.h>
#include <conio.h>
int n;
int a[10][10];
void citrematt();
{fstream f("graf.txt",ios::in);
f>>n;
cout<<endl;cout<<n;
for(int i=1;i<n;i++)
for(int j=1;j<n;j++)
f>>a[i][j];
f close()
cout<<endl;
}
void main()
{citiremat();
for (int k;k<=n;k++)
for (i=1;i<=n;i++)
for (j=1;j<=n;j++)
if (a[i][j]==0)
a[i][j]=a[i][k]*a[k][j];
for (i=1;i<=n;i++)
cout<<endl;
for(int j=1;j<=n;j++)
cout<<a[i][j]<<" "}
}
Comments: