diff --git a/.vscode/ipch/.DS_Store b/.vscode/ipch/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..dc2779cd40e6f9925197eaa18911072717fc96c6 Binary files /dev/null and b/.vscode/ipch/.DS_Store differ diff --git a/testMatrix.c b/testMatrix.c new file mode 100644 index 0000000000000000000000000000000000000000..c7d96f888941277809de370f5ab0099085b1548e --- /dev/null +++ b/testMatrix.c @@ -0,0 +1,63 @@ +#include <iostream> +#include <fstream> +#include <string> +#include <iomanip> + +using namespace std; + +int main(int argc, char *argv[]) +{ + ifstream myfile(argv[1]); + ifstream myfile1(argv[2]); + ofstream outfile("res.txt"); + + if (myfile.is_open() && myfile1.is_open()) + { + int arrSize = 0; + double arr[1001805]; // Ideally this would be a vector, but you said array + double arr1[1001805]; // Ideally this would be a vector, but you said array + + double res[1001805]; // Ideally this would be a vector, but you said array + + + while ( true) + { + double x; + myfile >> x; + if (myfile.eof()) + break; + arr[arrSize++] = x; + } + + arrSize=0; + while (true) + { + double x; + myfile1 >> x; + if (myfile1.eof()) + break; + arr1[arrSize] = x; + + res[arrSize]=arr[arrSize]-arr1[arrSize]; + outfile<<arrSize<<" "<<fixed<<setprecision(20)<< res[arrSize]<<" "<<arr[arrSize]<<" "<<arr1[arrSize]<<"\n"; + arrSize++; + } + + + + // I should have closed the file here, but as the program was ending I was lazy } + } + else + { + cout << "Unable to open file"; + } + + + outfile.close(); + myfile.close(); + myfile1.close(); + + return 0; + +} +