Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <climits>
- int i, x, y, j, a[101][101], n, m, p=INT_MIN;
- using namespace std;
- void citire(int &n)
- {
- ifstream f("adiacenta1.in");
- while(f>>x>>y)
- {
- a[x][y]=a[y][x]=1;
- p=std::max(p,x);
- p=std::max(p,y);
- }
- n=p;
- f.close();
- }
- void afis()
- {
- ofstream g("adiacenta1.out");
- for(i=1; i<=n; i++)
- {
- for(j=1; j<=n; j++)
- {
- g<<a[i][j]<<" ";
- }
- g<<endl;
- }
- g.close();
- }
- int main()
- {
- citire(n);
- afis();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement