MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / main

Function main

week06/examples/function.cpp:41–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41int main()
42{
43 using namespace std;
44
45 Matrix matA = {3,4};
46 matA.pData = new float[matA.rows * matA.cols]{1.f, 2.f, 3.f};
47
48 Matrix matB = {4,8};
49 matB.pData = new float[matB.rows * matB.cols]{10.f, 20.f, 30.f};
50
51 Matrix matC = {4, 2};
52 matC.pData = new float[matC.rows * matC.cols]{100.f, 200.f, 300.f};
53
54 // some operations on the matrices
55
56 float maxa = matrix_max(matA);
57 float maxb = matrix_max(matB);
58 float maxc = matrix_max(matC);
59
60 cout << "max(matA) = " << maxa << endl;
61 cout << "max(matB) = " << maxb << endl;
62 cout << "max(matC) = " << maxc << endl;
63
64
65 delete [] matA.pData;
66 delete [] matB.pData;
67 delete [] matC.pData;
68
69 return 0;
70}

Callers

nothing calls this directly

Calls 1

matrix_maxFunction · 0.70

Tested by

no test coverage detected