Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- int LL[100][100],MA[100][100];
- int n;
- int read_data()
- {
- fstream f;
- f.open("LLtoMA.txt",ios::in);
- f>>n;
- for(int i=1;i<=n;i++)
- for(int j=1;j<=n;j++)
- {
- f>>LL[i][j];
- }
- f.close();
- }
- int convert()
- {
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- if(LL[i][j]!=0)
- {
- MA[i][LL[i][j]]=1;
- }
- else{ MA[i][LL[i][j]]=0;}
- }
- }
- }
- int main()
- {
- read_data();
- convert();
- for(int i=1;i<=n;i++)
- {for(int j=1;j<=n;j++)
- {
- cout<<MA[i][j];
- }
- cout<<endl;
- }
- }
- /* Fisierul
- 5
- 2 5 0 0 0
- 1 3 5 0 0
- 2 4 0 0 0
- 3 5 0 0 0
- 1 2 4 0 0
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement