CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 100
void transpose(int A[][MAX],int AT[][MAX],int m,int n)
{
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			AT[j][i]=A[i][j];
		}
	}
}
int product_sum(int A[][MAX],int AT[][MAX],int a,int b,int m,int n)
{
	int sum=0;                    // a is row of transpose and b is column of matrix
	for(int i=0;i<m;i++)
	{
		sum+=AT[a][i]*A[i][b];
	}
	return sum;
}
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX])
{
	int AT[MAX][MAX];
	transpose(A,AT,m,n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			ATA[i][j]=product_sum(A,AT,i,j,m,n);
		}
	}
}
int main()
{
	int m,n;
	cin>>m>>n;
	int A[MAX][MAX],ATA[MAX][MAX];
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>A[i][j];
		}
	}
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cout<<ATA[i][j]<<" ";
		}
		cout<<endl;
	}
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;

#define MAX 10

void mat_in(int A[][MAX], int n1, int n2){

	for(int i=0; i<n1; i++){

		for(int j=0; j<n2; j++){

			cin>>A[i][j];
		}
	}
}

void display(int A[][MAX], int n1, int n2){

	for(int i=0; i<n1; i++){

		for(int j=0; j<n2; j++){

			cout<<A[i][j]<<" ";
		}
		cout<<endl;
	}
}

void transpose (int A[][MAX], int ATranspose[][MAX], int n1, int n2){

	for(int i=0; i<n1; i++){

		for(int j=0; j<n2; j++){

			ATranspose[j][i] = A[i][j];
		}
	}
}

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
	
	int AT[n][MAX];
	transpose(A, AT, m, n);
	
	for(int i=0; i<n; i++){
	
		for(int j=0; j<n; j++){
		
			ATA[i][j] = 0;
			for(int k=0; k<m; k++){
			
				ATA[i][j] += (AT[i][k]*A[k][j]);
			}
		}
	}
}

int main(){

	int m, n;
	cin>>m>>n;
	int A[m][MAX];
	mat_in(A, m, n);
	int ATA[n][MAX];
	
	compute_matrixtranspose_matrix_product (A, m, n, ATA);
	
	display(ATA, n, n);
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define M 10
void print(int A[][M],int m,int n)
{
	for(int i=0;i<m;i++)
	{for(int j=0;j<n;j++)cout<<A[i][j]<<" ";cout<<endl;}
}
void compute_matrixtranspose_matrix_product(int A[][M],int m,int n,int AtA[][M])
{
	int At[M][M];
	for(int i=0;i<m;i++)
	{
	for(int j=0;j<n;j++)At[j][i]=A[i][j];
	}
	for(int i=0;i<n;i++)
	{for(int j=0;j<n;j++)AtA[i][j]=0;}
	for(int i=0;i<n;i++)
	{for(int j=0;j<n;j++)
		for(int k=0;k<m;k++)AtA[i][j]+=At[i][k]*A[k][j];}
	print(AtA,n,n);
}
int main()
{
	int m,n;cin>>m>>n;int A[M][M];int AtA[M][M];//final should b nxn; 
	if((m<=8)&&(n<=8)&&(m>0)&&(n>0))
	{
		for(int i=0;i<m;i++)
		{for(int j=0;j<n;j++)cin>>A[i][j];}
	}
compute_matrixtranspose_matrix_product(A,m,n,AtA);
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
using namespace std;
#define max 100
void compute_matrixtranspose_matrix_product(int A[][max],int m,int n,int ATA[][max]){
	int AT[n][m];
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			AT[j][i]=A[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int sum=0;
			for(int k=0;k<m;k++){
				sum+=AT[i][k]*A[k][j];
				ATA[i][j]=sum;
			}
		}
	}	
}

int main(){
	int n,m;
	cin>>m>>n;
	int A[m][max];
	for (int i=0;i<m;i++){
		for(int j=0;j<n;j++){
			cin>>A[i][j];
		}
	}
	int ATA[n][max];
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	for (int i=0;i<n;i++){
                for(int j=0;j<n;j++){
			cout<<ATA[i][j]<<" ";
                }
		cout<<endl;
        }
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 100
void compute_matrixtranspose_matrix_product(int A[][MAX], int m, int n, int ATA[][MAX])
{
int B[MAX][MAX];
int i, j, k;
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
B[i][j]=0;
for(k=0; k<m; k++)
B[i][j]+=(ATA[i][k]*A[k][j]);
}
}
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
cout<<B[i][j];
if(!(j==n-1&&i==n-1)) cout<<" ";
}
if(i<n-1) cout<<endl;
}
}
int main()
{
int m, n; cin>>m>>n;
int A[MAX][MAX], ATA[MAX][MAX];
for(int i=0; i<m; i++)
for(int j=0; j<n; j++)
{
cin>>A[i][j];
ATA[j][i]=A[i][j];
}
compute_matrixtranspose_matrix_product(A, m, n, ATA);
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
using namespace std;

const int MAX = 10;

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
	int AT[n][m];

	for(int i=0; i<m; i++) for(int j=0; j<n; j++) AT[j][i] = A[i][j];

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			ATA[i][j] = 0;
			for(int k=0; k<m; k++)ATA[i][j] += AT[i][k]*A[k][j];
		}
	}

}

int main(){
	
	int m, n;
	cin>>m>>n;

	int a[MAX][MAX], ata[MAX][MAX];

	for(int i=0; i<m; i++) for(int j=0; j<n; j++) cin>>a[i][j];	

	compute_matrixtranspose_matrix_product(a, m, n, ata);

	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			cout<<ata[i][j]<<" ";
		}
		cout<<"\n";
	}

	


	return 0;
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 8
void Get_Matrix( int A[][MAX], int m, int n)
               {
                for(int i =0; i<m;i++)
                   {
                   for(int j = 0; j<n;j++)
                      {
                      cin>>A[i][j];
                      }
                    }
               }
void Get_Transpose( int A[][MAX], int AT[][MAX], int m , int n)
                  {
                   for(int i = 0; i<m;i++)
                      {
                       for(int j = 0; j<n;j++)
                          {
                           AT[j][i] = A[i][j];
                          }
                       }
                  }
void compute_matrixtranspose_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX])
                                           {
                                            int AT[MAX][MAX];
                                            Get_Transpose(A,AT,m,n);
                                            for(int i = 0; i<n;i++)
                                               {
                                               for(int j =0; j<n;j++)
                                                   {
                                                    ATA[i][j] = 0;
                                                    for(int k = 0; k<m;k++)
                                                       {
                                                        ATA[i][j] += AT[i][k]*A[k][j];
                                                       }
                                                    }
                                               }
                                            }
void print_matrix( int A[][MAX], int m, int n)
                 {
                 for(int i = 0; i<m;i++)
                    {
                    for(int j  =0; j<n;j++)
                       {
                        if( i == m-1 &&j ==n-1) // Just to tailor it to the output's needs
                          {
                          cout<<A[i][j];
                          }
                        else
                        cout<<A[i][j]<<" ";
                       }
                     cout<<endl;
                    }
                 }
int main()
{
int m, n;
cin>>m>>n;
int A[MAX][MAX],ATA[MAX][MAX];
Get_Matrix(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
print_matrix(ATA,n,n);
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<simplecpp>
const int MAX=100;
void getarray(int A[MAX][MAX], int m,int n){
cin >> m;
   cin >> n;
   int i,j;
   for(i=0;i<m;i++){
     for(j=0;j<n;j++){
      
        cin >> A[i][j];
        }
        }
   }
 void printarray(int ATA[MAX][MAX], int m){
 int i,j;
   for(i=0;i<m;i++){
     for(j=0;j<m;j++){
          cout << ATA[i][j]  << " ";
          }
          cout << endl;}
   }
void compute_matrixtranspose_matrix_product(int A[MAX][MAX],int m,int n,int ATA[MAX][MAX]){
int i,j,k;  

int AT[MAX][MAX];
 for(i=0;i<n;j++){
   for(j=0;j<m;j++){
    AT[i][j]=A[j][i];
}
}

   for(i=0;i<m;i++){
       for(j=0;j<m;j++){
         ATA[i][j]=0;
         for(k=0;k<n;k++){
           ATA[i][j]+=A[i][k]*AT[k][j];
          }
cout << ATA[i][j] << " ";}
cout << endl;} 
     }
main_program{
const int MAX=100;
int m,n;
int i,j;
int A[MAX][MAX];
int ATA[MAX][MAX];
getarray(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
printarray(ATA,m);
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
//m=rows; n=column 
int const MAX=100;

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int B[MAX][MAX];
for(int i=0; i<m ; i++){
	for(int j=0; j<n; j++){
	B[j][i]=A[i][j];
	}
}
	
int i,j,k;

for(i=0;i<n;i++) {
for(j=0;j<n;j++){
   	ATA[i][j] = 0;
	for(k=0;k<m;k++){
		ATA[i][j] += B[i][k]*A[k][j]; // dot product of i-th row of A and j-th column of B
			} // close innermost for loop (on k)
} // close middle for loop (on j)
} // close outer for loop (on i)
}

int main(){
int m,n;
cin >> m >> n;
int A[MAX][MAX] ;
int ATA[MAX][MAX];

for(int i=0; i<m ; i++){
	for(int j=0; j<n; j++){
	cin >> A[i][j];
	}
	}

compute_matrixtranspose_matrix_product (A,m, n, ATA);

for(int i=0; i<n ; i++){
	for(int j=0; j<n; j++){
	cout << ATA[i][j] << " ";
	}
	cout << endl;
}
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
# define MAX 8
void compute_matrixtranspse_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX]){
int C[MAX][MAX];
for(int i=0;i<n;i++){
for (int j=0;j<m;j++){
ATA[i][j]=A[j][i];	
C[i][j]=0;	
}					
}	
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for (int k=0;k<m;k++){
C[i][j]=C[i][j]+ATA[i][k]*A[k][j];					 
}						
}	
}
for (int i=0;i<n;i++){for(int j=0;j<n;j++){
cout<<C[i][j]<<" ";											 
}
cout<<endl;}																			   
}
int main(){
int m,n;cin>>m>>n;
int A[MAX][MAX];int ATA[MAX][MAX];int C[MAX][MAX];	
for(int i=0;i<m;i++){for(int j=0;j<n;j++){cin>>A[i][j];}}	
compute_matrixtranspse_matrix_product(A,m,n,ATA);	
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 9

void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int AT[][MAX],int M[][MAX]){
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){
		AT[j][i]=A[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
		M[i][j]=0;
			for(int k=0;k<m;k++){
			M[i][j]=M[i][j]+AT[i][k]*A[k][j];
			}
		}
	}
}

int main(void){
int m,n;
cin>>m;
cin>>n;
int A[m][MAX];
int AT[n][MAX];
int M[n][MAX];
	for(int i=0;i<m;i++){
		for(int j=0;j<n;j++){cin>>A[i][j];}
	}
compute_matrixtranspose_matrix_product(A,m,n,AT,M);
	for(int i=0;i<n;i++){
		for (int j=0;j<n;j++){cout<<M[i][j]<<" ";}
	cout<<endl;
	}
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
#define MAX 100
using namespace std;
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int X[][MAX]){
for(int i=0;i<n;i++){ 
for(int j=0;j<n;j++){ 
X[i][j]=0;
for(int k=0;k<m;k++){
X[i][j]+=A[k][i]*A[k][j]; 
}
}
}
}  
int main(){
int m,n;
int A[MAX][MAX],X[MAX][MAX];
cin>>m>>n;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>A[i][j];
}
}
compute_matrixtranspose_matrix_product (A,m,n,X);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<X[i][j]<<" ";
}
cout<<endl;
}
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
#define max 100
using namespace std;


void compute_matrixtranspose_matrix_product(int a[][max],int m,int n,int ata[][max]){
int at[n][m];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
at[j][i]=a[i][j];}}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
ata[i][j]=0;
for(int x=0;x<m;x++){
ata[i][j] +=at[i][x]*a[x][j];}}}}


int main(){
int m,n;
cin>>m>>n;
int a[m][max];
int b[n][max];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>a[i][j];}}
compute_matrixtranspose_matrix_product(a,m,n,b);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<b[j][i]<<" ";}
cout<<endl;}
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include<iostream>
using namespace std;
#define MAX 100
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int AT[n][m];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){AT[j][i]=A[i][j];}}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k=0;k<m;k++){ATA[j][i]=ATA[j][i]+AT[j][k]*A[k][i];}}}}
int main(){
int m,n;
cin>>m>>n;
int A[m][MAX];int ATA[n][MAX];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){cin>>A[i][j];}}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){ATA[i][j]=0;}}
compute_matrixtranspose_matrix_product (A,m,n,ATA);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){cout<<ATA[i][j]<<" ";}cout<<endl;}
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
using namespace std;

void compute_matrixtranspose_matrix_product (int a[][8], int m, int n, int ata[][8]){
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			ata[i][j] = 0;
			for (int k = 0; k < m; k++){
				ata[i][j] += a[k][i]*a[k][j];
			}
		}
	}
}

int main(){
	int m = 0, n = 0;
	cin >> m >> n;
	int a[m][8], ata[n][8];

	for (int i = 0; i < m; i++){
		for (int j = 0; j < n; j++){
			cin >> a[i][j];
		}
	}

	compute_matrixtranspose_matrix_product(a, m, n, ata);

	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			cout << ata[i][j] << " ";
		}
		cout << "\n";
	}

	return 0;
}

Grading criterion: Overall calculation is in the function.
Rating A: Function written as per given signature
Rating B: Function written but not as per signature, or some other partially wrong
Rating C: Not done in function
Rating D: 0
Assigned grade: A