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>
#define MAX 10
using namespace std;
void compute_matrixtranspose_matrix_product (int A[][MAX],int m,int n,int ATA[][MAX]) {
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>A[i][j]; 
}}
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] = ATA[i][j] +( AT[i][k] * A[k][j]);
}}
}}
int main() {
int m,n;
cin>>m>>n;
int a[MAX][MAX];int b[MAX][MAX];
compute_matrixtranspose_matrix_product (a,m,n,b);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout << b[i][j]<< " ";
} cout << "\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;
#define MAX 10
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];
}
}}

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

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

}

Grading criterion: 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<cmath>
#include<string.h>
using namespace std;

#define max 100

void input(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 print(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 atrans[][max],int n1,int n2)
{
for(int i=0;i<n1;i++)
      {
      for(int j=0;j<n2;j++)
          {
          atrans[j][i]=a[i][j];
          }
      }
}

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 m,n;
cin>>m>>n;
int a[m][max],b[n][max],c[n][max];
input(a,m,n);
transpose(a,b,m,n);
matrix_multiply(b,a,c,n,m,m,n);
print(c,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;
void compute_matrixtranspose_matrix_product(int A[][10],int m,int n,int ATA[][10]){
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+= A[k][i]*A[k][j];
    } ATA[i][j]=sum;
   }
 }return;
}
int main(){
int m,n;
cin>>m>>n;
int A[m][10];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++)cin>>A[i][j];
}
int ATA[n][10];
compute_matrixtranspose_matrix_product(A,m,n,ATA);
for(int i=0;i<n;i++){
cout<<endl;
for(int j=0;j<n;j++)cout<<ATA[i][j]<<" ";
}
}

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 9
void get2darr(int A[][MAX],int r,int c){
int i,j;
for(i=0;i<r;i++){
  for(j=0;j<c;j++){
     cin>>A[i][j];
}
}
}
void compute_matrixtranspose_matrix_product( int A[][MAX], int r, int c,int AtA[][MAX]){
      int B[MAX][MAX];
      
     for(int i=0;i<c;i++){
	for(int j=0;j<r;j++){
	   B[i][j]=A[j][i];
	}
    }
       for(int f=0;f<c;f++){
	  for(int k=0;k<c;k++){
           AtA[f][k]=0;
		for(int d=0;d<r;d++){
                   AtA[f][k]+=B[f][d]*A[d][k];
		} 
           }
       }


}
int main(){
int r,c;
cin>>r>>c;
int A[MAX][MAX];
int AtA [MAX][MAX];
get2darr(A,r,c);
compute_matrixtranspose_matrix_product ( A, r, c, AtA);
for(int i=0;i<c;i++){
   for(int j=0;j<c;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: 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 at(int a[][100],int n1, int n2, int b[][100]){
for(int i=0;i<n1;i++){
for(int j=0;j<n2;j++){
b[j][i]=a[i][j];}}}

void compute_matrixtranspose_matrix_product(int a[][100], int n1, int n2, int b[][100], int c[][100]){
for(int i=0;i<n2;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]+b[i][k]*a[k][j];}}}}

int main(){
int n1,n2;
cin>>n1>>n2;
int a[n1][100];
for(int i=0;i<n1;i++){
for(int j=0;j<n2;j++){
cin>>a[i][j];}}
int b[n2][100];
at(a,n1,n2,b);
int c[n2][100];
compute_matrixtranspose_matrix_product(a,n1,n2,b,c);
for(int i=0;i<n2;i++){
for(int j=0;j<n2;j++){
cout<<c[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 mode(int *a,int n){
	int max = 0,mode = 0;
	for(int i = 0;i<n;i++){
		if(a[i]>=max){
			max = a[i];
		}
	}
	max++;
	int b[max];
	for(int j = 0;j<max;j++){
		b[j] = 0;
	}
	for(int k = 0;k<n;k++){
		b[a[k]] = b[a[k]]+1;
	}
	for(int h = 0;h<max;h++){
		if(b[h]>=mode){
			mode = b[h];
		}
	}
	for(int r = 0;r<max;r++){
		if(b[r] == mode){
			cout<<r<<" "<<b[r]<<endl;
		}
	}
}
int main(){
	int n,count = 0;
	cin>>n;
	int arr[n];
	for(int i = 0;i<n;i++){
		cin>>arr[i];
	}
	mode(arr,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: 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>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
unsigned int a[n];int b[n];for(int j=0;j<n;j++){
b[j]=0;}
for(int i=0;i<n;i++){
cin>>a[i];}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){

if(a[i]==a[j]) b[i]=b[i]+1;}}
int p=0;int m;
for(p=0;p<n;p++){
if(b[p]>b[p+1]) m=b[p];
else m=b[p+1];
}
cout<< a[p]<<" "<<m;
}

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

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]){

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

int **pro=new int*[n];
for(int i=0;i<n;i++){
   pro[i]=new int[n];
}

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

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

return;
}


int main(){

int n,m;
cin>>m>>n;
int arr[MAX][MAX];
int aTT[MAX][MAX];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){cin>>arr[i][j];}
}

compute_matrixtranspose_matrix_product(arr,m,n,aTT);

}

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

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

}


int main(){
    int m,n;
    cin>>m>>n;
    int A[m][MAX];
    int ATA[n][MAX];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cin>>A[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            ATA[i][j]=0;
        }
    }
    compute_matrixtranspose_matrix_product ( A, m, n, ATA);
    for(int k=0;k<n;k++){
        for(int l=0;l<n;l++){
            cout<<ATA[k][l]<<" ";
        }
        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;
#define MAX 100
void accept(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]+=A[k][i]*A[k][j];
			}
		}
	}
}
void print(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];

	accept(A,m,n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	print(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>
#define MAX 1000
using namespace std;
void inpts(int a[MAX][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][MAX], int m, int n, int ATA[MAX][MAX]){
for (int i=0;i<MAX;i++){for(int j=0;j<MAX;j++){ATA[i][j]=0;}}
for(int i=0;i<n;i++){for(int k=0;k<n;k++){for (int j=0;j<m;j++){ATA[i][k]+=A[j][i]*A[j][k];}}}
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];
inpts(a,m,n);
int ata[MAX][MAX];
 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>
#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 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];
if(j!=n-1){cout<<" ";}
}
cout<<endl;
}
}
void transpose(int a[][max] ,int b[][max],int m,int n)
{
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
	b[j][i]=a[i][j];
}
}
}
void multiply(int a[][max],int b[][max],int c[][max],int m,int n)
{
for(int i=0;i<n;i++)
{
	for(int j=0;j<n;j++)
	{c[i][j]=0;
	for(int k=0;k<m;k++)
		{
		c[i][j]=c[i][j]+(b[i][k]*a[k][j]);
		}
	}
}
}
int main(){
int m,n;
cin>>m>>n;
int a[m][max];
input(a,m,n);
int b[n][max];
transpose(a,b,m,n);
int c[n][max];
multiply(a,b,c,m,n);
output(c,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