Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<string>
- using namespace std;
- int main()
- {
- ifstream file1;
- ifstream file2;
- file1.open("matrix1.csv");
- //file2.open("matrix2.csv");
- int rows_matrix1 = 0,rows_matrix2 = 0;
- int cols_matrix1 = 0, cols_matrix2 =0;
- char value;
- int array[100][100];
- int i=0, j=0;
- while(file1.good())
- {
- value = file1.get();
- if(value == '\n')
- {
- i++;
- rows_matrix1++;
- }
- else if(value == ',')continue;
- array[i][j] = (int)value;
- j++;
- cols_matrix1++;
- }
- for(int k=0;k<i;k++)
- {
- for(int y=0;y<j;y++)
- cout<<array[k][y];
- }
- file1.close();
- //file2.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement