Home > Back-end >  A heavyweight solution questions, writing for a long time, newbie on the road is not so good
A heavyweight solution questions, writing for a long time, newbie on the road is not so good

Time:10-06

The F1 (x) should be squared plus 10 x, the back of the same f2 is equal to the square of the x + x + 9, f3 for two times the square of x + 3 x + 30, f4 is 100 times the square of the x

CodePudding user response:

#include
Double f0 (double x) {return x; };
Double (double) x {f1 return * x x + 10; };
Double f2 (double x) {return * x x + 9; };
Double f3 (double x) {return * x x + 3 * x + 30; };
Double f4 (double x) {100 * x * x return; };

Int main () {
Double (* pf [5]) (double)={f0, f1, f2, f3 and f4};
Double matrix [5] [8].
Int the row, col.
Printf (" do 8 Numbers of input type doulble: \ n ");
For (col=0; Col<8; Col++)
Lf the scanf (" % ", & amp; Matrix [0] [col]);
For (row=1; Row<5; Row++) {
For (col=0; Col<8; Col++) {
Matrix [row] [col]=[row] pf (matrix [0] [col]);
}
}
For (row=0; Row<5; Row++) {
For (col=0; Col<8; Col++) {
Printf (" % 8.2 lf, "matrix [row] [col]);
}
printf("\n");
}
return 0;
};

CodePudding user response:

Fun
reference 1 floor response:
# include & lt; stdio.h>
Double f0 (double x) {return x; };
Double (double) x {f1 return * x x + 10; };
Double f2 (double x) {return * x x + 9; };
Double f3 (double x) {return * x x + 3 * x + 30; };
Double f4 (double x) {100 * x * x return; };

Int main () {
Double (* pf [5]) (double)={f0, f1, f2, f3 and f4};
Double matrix [5] [8].
Int the row, col.
Printf (" do 8 Numbers of input type doulble: \ n ");
For (col=0; Col<8; Col++)
Lf the scanf (" % ", & amp; Matrix [0] [col]);
For (row=1; Row<5; Row++) {
For (col=0; Col<8; Col++) {
Matrix [row] [col]=[row] pf (matrix [0] [col]);
}
}
For (row=0; Row<5; Row++) {
For (col=0; Col<8; Col++) {
Printf (" % 8.2 lf, "matrix [row] [col]);
}
printf("\n");
}
return 0;
};

Thank you thank you thank you requested
  • Related