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;
void transpose (int A[][100],int AT[][100],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 product (int A[][100],int B[][100],int C[][100],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]+=A[i][k]*B[k][j];}
}}}
void compute_matrixtranspose_matrix_product (int A[][100],int m,int n,int ATA[][100]){
int AT[100][100];
transpose (A,AT,m,n);
product( AT,A,ATA,m,n);
}
int main (){
int m,n;
int A[100][100],AT[100][100],ATA[100][100];
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>
#include<cmath>
using namespace std;
int main(){
int x=0;
int ans=0,n,b,i=0;
cin>>n;
while(true){
i++;int q=pow(10,i);b=n%q;
		if(b==n)break;}

for(int j=1;j<i+1;j++){
int q=pow(10,j);
int digit;
int l=pow(10,j-1);
int x=n%l;
digit=(n%q)-x;
digit=digit/l;
int d=i-j;
int w=pow(10,d);
ans=ans+(digit*w);
}
cout<<ans;}

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

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


int main(){

int m,n;
cin>>m;
cin>>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);

}

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

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


int main(){
    int m,n;
    cin>>m>>n;
    int A[MAX][MAX];
    int ATA[MAX][MAX];
    input_matrix(m,n,A);
    compute_matrixtranspose_matrix_product(m,n,A,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: 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 inputmatrix (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 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];
}
}
}

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

int main(){
int m,n;	
int A[MAX][MAX];
int ATA[MAX][MAX];
cin>>m>>n;
inputmatrix(A,m,n);

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>
using namespace std;

const int maxi=10;

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


int main(){
int m,n;
cin>>m>>n;
int A[maxi][maxi];
int ATA[maxi][maxi];
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);
}

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<bits/stdc++.h>
#define MAX 100

using namespace std;

void get2Darray (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 matrix_multiply (int A[][MAX], int B[][MAX], int C[][MAX], int nr1, int nc1, int nr2, int nc2)
{
	for(int i=0;i<nr1;i++) 
	{
		for(int j=0;j<nc2;j++)
		{
			C[i][j] = 0;
			for(int k=0;k<nc1;k++)
				C[i][j] = C[i][j] + A[i][k]*B[k][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<n;i++)
	{
		for(int j=0; j<m; j++)
			AT[i][j]=A[j][i];
	}
	matrix_multiply(AT, A, ATA, n,m,m,n);
	
	return;
}

int main()
{
	int m,n;
	cin >>m>>n;
	int A[MAX][MAX];
	get2Darray(A,m,n);
	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 <simplecpp>
#define maxsize 8
void inparr(int a[][maxsize],int m,int n)
	{
	for (int i=0;i<m;i++)
		{
		for (int j=0;j<n;j++)
			{
			cin>>a[i][j];
			}
		}
	}
	
void outarr(int a[][maxsize],int m,int n)
	{
	for (int i=0;i<m;i++)
		{
		for (int j=0;j<n;j++)
			{
			cout<<a[i][j]<<" ";
			}
		cout<<"\n";
		}
	}
	
void matrixmulti(int a[][maxsize],int m,int n,int c[][maxsize])
{
	int b[n][maxsize];
	for (int i=0;i<m;i++)
		{
		for (int j=0;j<n;j++)
			{
			b[j][i]=a[i][j];
			}
		}
	for(int p=0;p<n;p++)
		{
		for(int q=0;q<n;q++)
			{
			c[p][q]=0;
			for(int k=0;k<m;k++)
				{
				c[p][q]+=b[p][k]*a[k][q];
				}
			}
		}
	outarr(c,n,n);
}

main_program{
int m,n;
cin>>m>>n;
int a[m][maxsize];
int c[n][maxsize];
inparr(a,m,n);
matrixmulti(a,m,n,c);
}

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;
const int MAX=100;
void compute_matrixtranspose_matrix_product(int a[][MAX],int m,int n,int ata[][MAX])
{
int at[n][m];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
at[i][j]=a[j][i];
}}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
int x=0;
for(int k=0;k<m;k++)
{
x+=at[i][k]*a[k][j];
}ata[i][j]=x;
}}}
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;
}}

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

void cout_matrix (float A[MAX][MAX], int m, int n){
	int i,j; i=j=0;
	for(i=0; i<m; i++){
		for(j=0; j<n; j++) {
			cout<<A[i][j]<<" ";
			}
		cout<<endl;
	}
}

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

int main(){
int m,n; cin>>m>>n;
float A[MAX][MAX];
float ATA[MAX][MAX];
int p,q; p=q=0;
for(p=0; p<n; p++){
	for(q=0;q<n;q++) ATA[p][q] = 0;
	}
cin_matrix(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
cout_matrix(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 transpose(int A[][max],int AT[][max],int m,int n){
    for(int j=0;j<n;j++){
        for(int i=0;i<m;i++){
            AT[j][i]=A[i][j];
        }
    }
}

void transpose_product(int A[][max], int m, int n, int ATA[][max]){
    int AT[n][max];
    transpose(A,AT,m,n);
    for(int j=0;j<m;j++){
        for(int i=0;i<m;i++){
            ATA[i][j]=0;
            for(int k=0;k<n;k++){
                ATA[i][j]+=(AT[k][j]*A[i][k]);
            }
        }
    }
}

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

using namespace std;
void compute_matrixtranspose_matrix_product (int A[][MAX], int B[][MAX], int n, int m);

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

void compute_matrixtranspose_matrix_product(int A[][MAX], int B[][MAX], int n, int m)
{
int C[MAX][MAX];
 int nr1=n;
  int nc1=m;
 int nr2=m;
int nc2=n;
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];
      }
    }
   }
DISPLAYDATA(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>

#define MAX 100
using namespace std;
void input(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 output(int A[MAX][MAX], int m, int n)
{
for( int i=0;i<m;i++)
{
	for(int j=0;j<n;j++)
	{
	cout<<A[i][j];
	cout<<" ";
	}
      cout<<endl;
}
}

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

        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 compute_matrixtranspose_matrix_product(int A[][MAX], int m, int n, int R[][MAX]){
int B[n][m];
	for(int i=0; i<m; i++){
		for(int j=0; j<n; j++){
		B[j][i]=A[i][j];
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
		R[i][j]=0;
		for(int k=0; k<m; k++){
		R[i][j]=R[i][j]+B[i][k]*A[k][j];
		}
		}
	}
	return;
}
int main(){
int m,n;
cin>>m>>n;
int A[m][100];
int R[n][100];
	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, R);
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
		cout<<R[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 input(int A[][MAX],int m, int n)
{
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin >> A[i][j];
}
}
}
void compute_matrixtranspose_matrix_product(int A[][MAX],int m, int n)
{
int At[MAX][MAX], AAt[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<m;j++)
{
AAt[i][j]=0;
for(int k=0;k<m;k++)
{
AAt[i][j]=AAt[i][j]+A[i][k]*At[k][j];
}
}
}
}
int main()
{
int n,m;
int A[MAX][MAX];
int At[MAX][MAX];
int AAt[MAX][MAX];
cin >> m >> n;
input( A, m,  n);
compute_matrixtranspose_matrix_product(A, m, n);
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout << AAt[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