Can you tell me how to resolve my problem.
i can reserve the matrix A and B into file, but how to read , i can't remember...above, shows what i pretend to do..
# include <iostream>
# include <fstream>
using namespace std;
int main()
{
int matriz[3][3];
int x,i,j;//variables for lines:.
int y,z,l;//variables for columms:.
int opt;
ofstream write;
ifstream read;
cout<<"Select one opction"<<endl;
cout<<"1.:Insert matriz A"<<endl;
cout<<"2.:Insert matriz B"<<endl;
cout<<"3.:To add"<<endl;
cout<<"4.:To decuct"<<endl;
cout<<"5.:Exit"<<endl;
cin>>opt;
switch(opt)
{
case 1:
for(x=0; x<=1; x++)
{
for(y=0; y<=1; y++)
{
cin>>matriz[x][y];
}
}
write.open("Resultado das Matrizes.txt",ios::app);
if(write.is_open())
{
write<<matriz[x][y];
write.close();
}
else
{
cout<<"the matrix(A) it's empty!";
}
break;
case 2:
for(i=0; i<=1; i++)
{
for(z=0; z<=1; z++)
{
cin>>matriz[i][z];
}
}
escrever.open("Resultado das Matrizes.txt",ios::app);
if(write.is_open())
{
write<<matriz[i][z];
write.close();
}
else
{
cout<<"the matrix (B) it's empty!";
}
break;
case 3:
read.open("Resultado das Matrizes.txt",ios::out);
if(read.is_open())
{
read>>matriz[x][z]<<endl<<matriz[i][z];
read.close();
}
else cout<<"a matriz está vazia";
case 4:
}
return 0;
}
Can you tell me?????