1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#include <iostream.h>
#include <math.h>
#include <time.h>
#include <iomanip.h>
#include <stdlib.h>
#include <stdio.h>
#include <fstream.h>
#define nMax 8
void SaveFileA(double A[nMax][nMax], int &n);
main()
{
double A[nMax][nMax], An[nMax][nMax], lamn[nMax], S[nMax][nMax], XN[nMax][nMax];
int Valg1234,a,b,c,d,i,j,n,ValgTastA48,
char SaveA;
ofstream UdfilA;
cout<<"\nDo you wish to save n and A(nxn)? press y/n ";
cin>>SaveA;
if(SaveA=='y')
{
SaveFileA(A,n);
}
else
{
cout<<"You choose not to save\n";
}
}
void SaveFileA(double A[nMax][nMax], int &n) //void function save to AMat.txt
{
int i, j;
cout<<"You choose to save A";
ofstream UdFil;
UdFil.open("AMat.txt");
UdFil<<n<<"\n";
for (i=0; i<n; i=i+1)
{
for (j=0; j<n; j=j+1)
{
UdFil<<A[i][j];
}
cout<<"\n";
}
UdFil.close();
}
|