C/C++ Comment Standards
I. File Header
Each file in the solution shall have a comment block which identifies:
The file name,
The author of the file,
Modification History
a Who modified the file b When
The classes/procedures in the file with a one line description
/***************************************************************************
File: c
Author: Richard Goodrum
Procedures:
main - test program which initializes the data elements, time matmul, and prints results
matmul - brute force matrix multiplication
***************************************************************************/
II. Class/Procedure Header
Each class/procedure shall have a comment block preceding it which contains:
The class/procedure name,
The author of the class/procedure,
Modification History
Who modified the class/procedure
When
A summary description of the class/procedure, 4. A list of all arguments with:
Argument name,
Direction: Input (I/P), Output (O/P), Input/Output (I/.O),
Type (I.e., char, double, float, int, long, ),
One line description of the
/***************************************************************************
int main( int argc, char *argv[] )
Author: Dr. Richard A. Goodrum, D.
Date: 16 September 2017
Description: Generates two matrices and then calls matmul to multiply
Finally, it verifies that the results are
*
Parameters:
* argc |
I/P |
int |
The number of arguments on the command line |
* argv |
I/P |
char *[] |
The arguments on the command line |
* main |
O/P |
int |
Status code (not currently used) |
**************************************************************************/
/***************************************************************************
int matmul( int l, int m, int n, float *A, float *B, float *C )
Author: Dr. Richard A. Goodrum, D.
Date: 16 September 2017
Description: brute force matrix multiplication function.
*
Parameters:
* l |
I/P |
int |
The first dimension of A and C |
* m |
I/P |
int |
The second dimension of A and first of B |
* n |
I/P |
int |
The second dimension of B and C |
* A |
I/P |
float * |
The first input matrix |
* B |
I/P |
float * |
The second input matrix |
* C |
O/P |
float * |
The output matrix |
* matmul |
O/P |
int |
Status code (not currently used) |
***************************************************************************/
III. Inline Comments
Many lines of the file should include comments to describe the concept represented by the line. For example:
y = m * x + b; // Calculate the value of y based on a linear equation and
// the value of x
IV. Other Comments
Occasionally, a block of code needs a preamble to explain its nature. Hence, a block comment should precede it.
int matmul( int l, int m, int n, float *A, float *B, float *C )
{
int i, j, k;
for( i=0; i<l; i++ ) // Loop over the rows of A and C.
for( k=0; k<n; k++ ) // Loop over the columns of B and C
{
// Initialize the output element for the inner
// product of row i of A with column j of B C[i*n+k] = 0;
for( j=0; j<m; j++ ) // Loop over the columns of A and C
{
C[i*n+k] += A[i*m+j] * B[j*n+k]; // Compute the inner product
}
}
}
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of