Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
problem5 review fundamentos
//gcc 5.4.0 #include <stdio.h> float f1(float n){ return n*n*n; } float f2(float n){ return 3*(n*n); } float f3(float n){ return 6*n; } //////////////////////////////////// void loadFirstRow(int rows, int cols, float M[rows][cols]){ for ( int i = 0; i<cols; i++){ scanf( "%f",&M[0][i]); } } void loadMatrix(int rows, int cols, float M[rows][cols], float (*p[])(float)){ for ( int i = 1;i<rows; i++){ for ( int j = 0; j<cols;j++){ M[i][j] = p[i-1](M[0][j]); } } } void printMatrix( int rows, int cols, float M[rows][cols]){ for (int i= 0 ; i<rows; i++){ for ( int j=0; j<cols;j++){ printf("%f ",M[i][j]); } printf("\n"); } } int main(void) { float M[4][5] = {0}; float (*fs[3])(float) = {f1,f2,f3}; loadFirstRow(4,5,M); printMatrix(4,5,M); loadMatrix(4,5,M,fs); printMatrix(4,5,M); return 0; }
run
|
edit
|
history
|
help
0
A_141212_OrdenarArray
Michael Bean's Spring 2017 Lab 3 v1.1
Primes in binary
Spring 2017 Lab 4 v1.1
sume of diagonal v.1
Project 4 v.1
A_141201_MatrizTodosDistintos
sphere
joseph a triangle
linux (mostly) true random number generator