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<simplecpp>
#define MAX 100

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]+=A[k][i]*A[k][j];
			}
                }
        }
}

main_program{
	int m, n, A[MAX][MAX], ATA[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, ATA);
	for(int i=0; i<n; i++){
                for(int j=0; j<n; j++){ 
                        cout<<ATA[i][j];
			if(j<n-1)cout<<" ";
                }
		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 10
using namespace std;

void f(int A[][MAX],int m,int n){

int AT[n][m];

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

int AM[n][n];

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

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

}

int main(){

int m,n;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];
    }
}

f(A,m,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: 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;

   void GaussElim ( float A[][Max] float *b int n)
{   int i,j,k ;
        
 for (i=0; i<m; i++)
{    
if (A[i][i]==0)  
     for ( j=0; j<n; j++)
  (  
         A[j][i]= A[j][i]/A[i][i]
    }
}     
        for (k=0 ; k<m1 ; k+++)
           ( A[i][j]=0

A[k][j]=A[k][j]/a[i][k]   }

O   X[i]= A[i][k]
    ( cout<<"number n;)
    a[i]=a{j]-ratio *A[i] ;

 A= i+j+K ;
   
      for (i= n-1; i<n; i++)
{  
   (i = n1, j=n2 , k++m1)
  (cout<<n1/n2 number)

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;
#define MAX 100

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]=ATA[i][j]+AT[i][k]*A[k][j]; } } } }

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

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






}
int main()
{int m,n;
cin>>m>>n;
int **A = new int*[m];
for (int i=0;i<m;i++){
A[i]=new int[n];}
for (int i=0;i<m;i++){
    for(int j=0;j<n;j++){
        cin>>A[i][j];}}
int **AT = new int*[n];
for (int i=0;i<n;i++){
    AT[i]=new int[m];}
 
for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
        AT[i][j]=A[j][i];}}
compute_matrixtranspose_matrix_product (A,m,n,AT);

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;
const int MAX=100;
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
int AA[MAX][MAX];
for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
        AA[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]+=AA[i][k]*
A[k][j];
}
}
}
}
int main(){
int m,n;
cin>>m>>n;
int A[MAX][MAX];
int AA[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:
//22B1068


#include <iostream>
using namespace std;
#define MAX 8

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] += A[k][i] * A[k][j];
		}
	}
}

void get2Darr(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 print2Darr(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 << "\n";
	}
}

int main(){
	int m, n;
	cin >> m >> n;
	int A[m][MAX], ATA[n][MAX];
	get2Darr(A, m, n);
	//print2Darr(A, m, n);
	compute_matrixtranspose_matrix_product(A, m, n, ATA);
	print2Darr(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 MAX 100
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX])
{
int i,j,k,mult[m][m];
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
mult[i][j]=0;
for(k=0;k<m;k++)
{
mult[i][j]+=ATA[i][k]*A[k][j];
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
cout<<mult[i][j]<<" ";
cout<<endl;
}
}
int main()
{
int m,n,i,j;
cin>>m>>n;
int a[m][MAX],at[n][MAX];
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
int x;
cin>>x;
a[i][j]=x;
at[j][i]=x;
}
}
 compute_matrixtranspose_matrix_product(a,m,n,at);
}

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

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

}

int main()
{

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

	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]; 
			} 
} 
}
}
int main()
{
	int m,n;
	cin>>m;
	cin>>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>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <cmath>
using namespace std;

#define MAX 200

void transpose (int A[][MAX], int ATranspose[][MAX], int n1, int n2) {
    int i,j=0;
    for(i=0;i<n1;i++) {
        for(j=0;j<n2;j++) {
            ATranspose[j][i]=A[i][j];
        }
    }
}

void display (int A[][MAX], int n1, int n2) {
	int i,j=0;
	for(i=0;i<n1;i++) {
        	for(j=0;j<n2;j++) {
            	cout<<A[i][j]<<" ";
        }
        cout<<endl;
    }
}

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

void input (int A[][MAX], int n1, int n2) {
	int i,j=0;
	for(i=0;i<n1;i++) {
        	for(j=0;j<n2;j++) {
            	cin>>A[i][j];
            	}
        }
}

int main() {
	int n1,n2=0;
	cin>>n1>>n2;
	int matrix[n1][MAX];
	int matranspose[n2][MAX];
	input(matrix,n1,n2);
	transpose(matrix,matranspose,n1,n2);
//	cout<<endl;
//	display(matrix,n1,n2);
//	cout<<endl;
//	display(matranspose,n2,n1);
	compute_matrixtranspose_matrix_product(matrix,n1,n2,matranspose);
}

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 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  transpose(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 compute_matrixtranspose_matrix_product(int A[][max],int m,int n,
int ATA[][max]){int B[100][100];transpose(A,B,m,n);
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 k=0;k<m;k++){
for(int j=0;j<n;j++){
ATA[i][j]+=B[i][k]*A[k][j];
}
}
}
}
void output(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 A[100][100],B[100][100],ATA[100][100];
int m,n;
cin>>m>>n;
input(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
output(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;
const int Max=100;
void input_matrix (int A[][Max], int m, int n) {
int i,j;
i=j=0;
while (i<m) {
while (j<n) {
cin>>A[i][j];
j++; }
j=0;
i++; }  }
void transpose_matrix (int A[][Max], int m, int n, int At[][Max]) {
int i,j;
i=j=0;
while (i<m) {
while (j<n) {
At[j][i]=A[i][j];
j++;}
j=0;
i++; } }
void compute_matrixtranspose_matrix_product (int A[][Max], int m, int n,int AtA[][Max], int At[][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];  } } } }
void display_matrix (int AtA[][Max], int n) {
int i,j;
i=j=0;
while (i<n) {
while (j<n) {
cout<<AtA[i][j]<<" ";
j++; }
j=0;
cout<<endl;
i++; } }

int main() {
int m,n;
cin>>m>>n;
int A[m][Max];
int At[n][Max];
int AtA[n][Max];
input_matrix (A,m,n);
transpose_matrix (A,m,n,At);
compute_matrixtranspose_matrix_product (A,m,n,AtA,At);
display_matrix (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: 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;
const int MAX=100;
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];}}
}
int**transpose(int a[][MAX],int m,int n){
int**b=new int*[n];
for(int i=0;i<n;i++){b[i]=new int[m];}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
b[j][i]=a[i][j];}}
return b;
}
void compute_matrixtranspose_matrix_product(int a[][MAX],int m,int n,int ata[][MAX]){
int**b=transpose(a,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];
}}}
}
void output(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[m][MAX];
int ata[n][MAX];
input(a,m,n);
compute_matrixtranspose_matrix_product(a,m,n,ata);
output(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