How values given file(note pad), please fix it

#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

int main()
{

fstream F2("input.txt" );
const int rowSize = 4;
const int columnSize = 4;
int matrix[rowSize][columnSize];

ifstream arquivo;
arquivo.open("input.txt");

cout << "input matrix \n";
cout << "\n";

for (int i = 0; i<rowSize; i++){
for (int j = 0; j<columnSize; j++){

arquivo >> matrix[i][j];

cout << matrix[i][j] << "\t";
F2 << matrix[i][j] << "\t";
}
cout << "\n";
F2 << "\n";

}
int a=matrix[0][3],b=matrix[1][2],c=matrix[2][1],d=matrix[3][0];
int m=a*b*c*d;
cout << "\n";
F2<< "\n";
cout << "Intermediate level \n";
F2 << "Intermediate level \n";
cout << "\n";
F2 << "\n";
cout << a<<"*"<< b<<"*"<<c<<"*"<<d<<" = "<<m<<"\n";
F2 << a<<"*"<< b<<"*"<< c<<"*"<<d<<" = "<< m<<"\n";
cout << "\n";
F2 << "\n";

cout << "output matrix \n";
F2<< "output matrix \n";

cout << "\n";
F2 << "\n";

for (int i = 0; i<rowSize; i++){
for (int j = 0; j<columnSize; j++){
if (j==3){
cout << m << "\t";
F2 << m << "\t";
}

else{
cout << matrix[i][j] << "\t";
F2 << matrix[i][j] << "\t";
}
}
cout << "\n";
F2 << "\n";
}
system("pause");
return 0;
}
Last edited on
Topic archived. No new replies allowed.