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 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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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<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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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], 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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;

   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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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;
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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;
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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:
//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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
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 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: Eg Use of functions beyond what was instructed or any other nice quality
Rating A: Some extra nice qualities
Rating B: 0
Rating C: 0
Rating D: nothing extra
Assigned grade: D