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:
//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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: 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>
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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 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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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 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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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 <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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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_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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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 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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
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 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: 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>
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: quality of variable names
Rating A: good variable names
Rating B: ok variablenames
Rating C: poor naming of variables
Rating D: 0
Assigned grade: A