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 compute_matrixtranspose_matrix_product (int a[][max], int m, int n, int ata[][max]){
  int at[n][m];
  for(int i=0;i<n;i++){
  for(int j=0;j<m;j++) at[i][j]=a[j][i];}
  
  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],ata[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,ata);
  for(int i=0;i<n;i++){
  for(int j=0;j<n;j++) {
    cout<<ata[i][j];
  if(j<n-1) cout<<" ";
  else cout<<endl;}
  }
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 tranpose(int a[][max],int b[][max],int m,int n){
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			b[i][j]=a[j][i];
			}
		}
	}
	
	
void matrix_mult(int a[][max],int m,int n,int ata[][max]){
	
	int b[n][max];
	tranpose(a,b,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]+=b[i][k]*a[k][j];
				}
			}
		}
	
	for (int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout<<ata[i][j]<<" ";
		}
		cout<<endl;
	}
}





int main(){
 int n,m;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];
 		}
 	}

matrix_mult(a,m,n,ata);

 }

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 ATranspose[n][m];
	for(int i=0;i<m;i++)
        {
                for(int j=0;j<n;j++)ATranspose[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] += ATranspose[i][k]*A[k][j];
			}
		}
	}
	for(i=0;i<n;i++)
        {
                for(j=0;j<n;j++)cout << ATA[i][j] << " ";
		cout << endl;
	}
}

int main()
{
	int m,n;
	cin >> m >> n;
	if(m>8 || n>8)
	{
		cout << "Invalid input";
		return 0;
	}
	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);
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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;
 int main(){
 	
 	int row;int col;
 	cin>>row>>col;
 	
 	int **a= new int*[row];
 	for(int i=0; i<row; i++){
 	a[i]=new int [col];
 	}
 	
 	for(int i=0; i<row; i++){
 	for(int j=0; j<col; j++){
 	cin>>a[i][j];
 	}
 	}
 	for(int i=0; i<col; i++){
 	for(int j=0; j<row; j++){
 	cout<<a[j][i];
 	}

 	}
 	return 0;
 	}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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>

using namespace std;
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX])
	
	cin>> A[m][n];
	cout<<m<<endl<<n<<endl<<ATA[][MAX]<<endl;
	
int main(){
	int m,n;
	
	void compute_matrixtranspose_matrix_product()
	

}
return 0;

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 create_2D_arr(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 compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int AT[MAX][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++){
			ATA[i][j] = 0;
	for(int k=0;k<m;k++){
			ATA[i][j] += AT[i][k]*A[k][j];
			}
}
}
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
cout<<ATA[i][j]<<" ";}
cout<<endl;
}
}
int main(){
int m,n;cin>>m>>n;
int A[MAX][MAX];int ATA[MAX][MAX];
create_2D_arr(A,m,n);
compute_matrixtranspose_matrix_product (A,m,n,ATA);
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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>
#define max 100
void product(int a[][max],int m,int n,int at[][max],int ata[][max]);


main_program{
int a[max][max];
int i,j,n,m;
cin>>m>>n;
for(i=0;i<m;i++)
	{
		for(j=0;j<n;j++)
		{
			cin>>a[i][j];
		}
	}
int at[max][max],ata[max][max];
for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			at[i][j]=a[j][i];
		}
	}
product(a,m,n,at,ata);	
for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			cout<<ata[i][j]<<" ";
		}
		cout<<endl;
	}

}

void product(int a[][max],int m,int n,int at[][max],int ata[][max])
{
	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]+=at[i][k]*a[k][j];
			}
		}
	}
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 20
using namespace std;
void transpose(int A[][MAX],int B[][MAX],int m,int n){
for(int i=0;i<=m-1;i++){
for(int j=0;j<=n-1;j++){
B[j][i]=A[i][j];}}}
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int B[n][MAX];transpose(A,B,m,n);
for(int i=0;i<=n-1;i++){
for(int j=0;j<=n-1;j++){int sum=0;
for(int k=0;k<=m-1;k++){
sum=sum+(B[i][k])*(A[k][j]);}
ATA[i][j]=sum;}}}
int main(){
int m,n;
cin>>m>>n;
int A[m][MAX];
for(int i=0;i<=m-1;i++){
for(int j=0;j<=n-1;j++){
cin>>A[i][j];}}
int ATA[n][MAX];
compute_matrixtranspose_matrix_product(A,m,n,ATA);
for(int i=0;i<=n-1;i++){int j=0;
for( j=0;j<=n-2;j++){
cout<<ATA[i][j]<<" ";}
cout<<ATA[i][j]<<endl;}
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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 compute_matrixtranspose_matrix_product(int A[][MAX],int m ,int n,int ATA[][MAX]){
	int c[m][m];
		for(int i=0;i<n;i++){
			for(int j=0;j<m;j++){
				ATA[j][i]= A[i][j];
			}
		}
	for(int i=0;i<m;i++){
		for(int j=0;j<m;j++){
			c[i][j]=0;
			for(int k=0;k<n;k++){
			c[i][j]+= ATA[i][k]*A[k][j];
			}
			cout<<c[i][j]<<" ";
		}
		cout<<"\n";
	}
	}
int main(){
	int n,m;
	cin>>n>>m;
	int A[MAX][MAX];
	int ATA[MAX][MAX];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
		cin>>A[i][j];
		}
	}
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	
}

Grading criterion: Product calculation code (separate transpose matrix should not be created)
Rating A: Fully corrrect
Rating B: Almost correct
Rating C: Tried something in somewhat right direction
Rating D: Code not there or totally wrong
Assigned grade: D
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][max],int m,int n,int ata[max][max]){
int at[max][max];

for(int x=0;x<m;x++){
	for(int y=0;y<n;y++){
		at[y][x]=a[x][y];

}
}

/*for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout<<at[i][j]<<" ";}
cout<<endl;}
*/

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] =ata[i][j]+ at[i][k]*a[k][j];
			} // 
} 


}
}

int main(){

int m,n;
cin>>m>>n;

int a[max][max];

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



int ata[max][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;
}
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>
#define MAX 100
using namespace std;
void input(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 compute_matrixtranspose_matrix_product(int A[][MAX],int m,int n,int ATA[][MAX]){
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]=ATA[i][j]+A[k][i]*A[k][j];
}
}
}
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
cout<<ATA[i][j];if (j<m-1){cout<<" " ;}
}
if (i<m-1) {cout<<endl; }
}
}
int main(){
int m,n;
cin>>m>>n;
int A[m][MAX],ATA[n][MAX];
input (A,m,n);
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: 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>
#include<cstring>
#include<cmath>
#define MAX 100
using namespace std;
void transpose(int a[][MAX], int m, int n, int b[][MAX])
{
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
a[i][j]=b[j][i];
}
}
}
void matrix_multiply (int A[][MAX], int B[][MAX], int C[][MAX], int nr1, int nc1, int nr2, int nc2){
if (nc1 != nr2) { cout << "dimension mismatch"; return;}
int i,j,k;
for(i=0;i<nr1;i++) {
for(j=0;j<nc2;j++){
			C[i][j] = 0;
	for(k=0;k<nc1;k++){
			C[i][j] += A[i][k]*B[k][j];}}}}
			
int main(){
int a,n,m;
cin>>n>>m;
int [n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}}
int at [m][max];
transpose(a,at,n,m);
matrix_multiply(a,n,m,at,c);
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout<<at[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: 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>
#define max 100
using namespace std;

void 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 compute_matrixtranspose_matrix_product(int A[][max],int m,int n,int ATA[][max]){
	int AT[max][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++){
			ATA[i][j]=0;
			for(int k=0;k<m;k++){
				ATA[i][j]+=AT[i][k]*A[k][j];}}}}

void print(int ATA[][max],int n){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cout<<ATA[i][j]<<" ";}
		cout<<"\n";}}

int main(){
	int n,m;
	cin>>m>>n;
	int A[max][max],ATA[max][max];
	matrix(A,m,n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	print(ATA,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>
#define MAX 100
using namespace std;
void compute_matrixtranspose_matrix_product(int A[][MAX], int m, int n, int ATA[][MAX])
{
	int AT[MAX][MAX];
	for(int i=0; i<m; i++)
	{
		for(int j=0; j<n; j++)
		{
			AT[j][i]=A[i][j];
		}
	}
	int i1, i2, i3;
	for(i1=0; i1<n; i1++)
	{
		for(i2=0; i2<n; i2++)
		{
			ATA[i1][i2]=0;
			for(i3=0; i3<m; i3++)
			{
				ATA[i1][i2]=ATA[i1][i2]+AT[i1][i3]*A[i3][i2];
			}
		}
	}
}
void input_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 print_matrix(int A[][MAX], int m, int n)
{
	for(int i=0; i<m; i++)
	{
		for(int j=0; j<n; j++)
		{
			cout << A[i][j] << " ";
		}
		cout << endl;
	}
}
int main(){
	int m,n;
	cin >> m >> n;
	int A[MAX][MAX], ATA[MAX][MAX];
	input_matrix(A, m, n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	print_matrix(ATA, n, 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 100

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

{

	for (int j=0;j<m;j++)
	{
		for (int i=0;i<m;i++)
		{
			ATA[i][j]=0;
		}
	}
	if (n==1)
	{
		for (int p=0;p<m;p++)
	{
		for (int q=0;q<m;q++)
		{
			
			{
			ATA[p][q]=A[p][0]*A[q][0];
			}
		}
	}
}
	else
	{
	for (int p=0;p<m;p++)
	{
		for (int q=0;q<m;q++)
		{
			for (int v=0;v<n;v++)
			{
			ATA[p][q]=ATA[p][q]+A[p][v]*A[q][v];
			}
		}
	}
}
}
int main()
{
	int m,n;
	cin>>n>>m;
	int A[m][MAX];
	int ATA[m][MAX];
	for (int j=0;j<n;j++)
	{
		for (int i=0;i<m;i++)
		{
			cin>>A[i][j];
		}
	}
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	for (int p=0;p<m;p++)
	{
		for (int q=0;q<m;q++)
		{
			cout<<ATA[p][q]<<" ";
		}
		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 8
using namespace std;

void matprod (int A[MAX][MAX],int B[MAX][MAX],int C[MAX][MAX],int m1,int n1,int m2,int n2){
	for(int i = 0;i<m1;i++){
		for(int j = 0;j <n2;j++){
			C[i][j] = 0;
			for(int k = 0;k < n1;k++){
				C[i][j] = C[i][j] + A[i][k]*B[k][j];
			}
		}
	}
}
void transpose (int A[MAX][MAX],int AT[MAX][MAX],int m,int n){
for(int i = 0;i< n;i++){
	for(int j =0;j<m;j++){
		AT[i][j] = A[j][i];
	}
} 
}

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

	
}
int main(){
	int A[MAX][MAX];
	int m,n;
	cin >> m;
	cin >> n;
	for(int i=0;i < m;i++){
		for(int j=0;j < n;j++){
			cin >> A[i][j];
		}
	}
	int ATA[MAX][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