wrote a program of working with matrices and vectors. All calculations spent higher, it remains only to display the results to the file. The matrix is announced as a double. Here is a fragment of code:
file * inputfile;
INPUTFILE = FOPEN ("INPUT.TXT", "W +");
FPRINF (INPUTFILE, "Matrix C \ R \ N \ R \ n");
For (int i = 0; i & lt; m; i ++) {
For (int j = 0; j & lt; n; j ++) {
FPRINTF (INPUTFILE, "%. 2LF", C [I] [J]);
FPRINF (INPUTFILE, "\ T \ T");
}
FPRINTF (INPUTFILE, "\ R \ N \ r \ n");
}
FClose (Inputfile);
When compiling issues errors. F: \ Mingw \ include \ stdio.h: 453: 38: Note: Expected ‘Const Char *’ But Argument Is of Type ‘Double’. other.
Answer 1
Try Add (char *) in front of the pointer to the matrix, which is transmitted to the FPRINTF function.
fprintf (inputfile, "%. 2lf", (char *) C [i] [J]);