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;
//Matrix
void matrix(int a[10][10], int m, int n){
for (int i=0; i<m; i++){
for (int j=0; j<n; j++){
cin >> a[i][j];
}}}
//Printing the matrix
void print_matrix(int a[10][10], int m, int n){
for (int i=0; i<m; i++){
for (int j=0; j<n; j++){
cout << a[i][j] << " ";}
cout << endl;
}}
//transpose
void transpose(int a[10][10],int b[10][10], int m, int n){
for (int i=0; i<m; i++){
for (int j=0; j<n; j++){
b[j][i]=a[i][j];
}}}
//matrix multiplication
void matrix_multiplication(int c[10][10], int a[10][10], int b[10][10], int m, int n){
for (int i=0; i<n; i++){
for (int j=0; j<m; 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 a[10][10];
int b[10][10];
int c[10][10];
int m;
int n;
cin >> m >> n;
matrix(a,m,n);
transpose(a,b,m,n);
matrix_multiplication(c,a,b,m,n);
print_matrix(c,n,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 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]<<" ";}
cout<<endl;
}
}
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;
}
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++){
for(int k1=0;k1<m;k1++){
ATA[i][j]=ATA[i][j]+ AT[i][k1]*A[k1][j];
}
}
}
}
int main(){
int m,n;
cin>>m>>n;
int A[m][MAX];
input(A,m,n);
int ATA[n][MAX];
compute_matrixtranspose_matrix_product(A,m,n,ATA);
output(ATA,n,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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], int m, int n, int ATA[][MAX]){
int i,j;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
ATA[i][j]=A[j][i];
}
}
int k=0;
int c[n][n];
for(i=0;i<n;i++){
for(j=0;j<n;j++){
c[i][j]=0;
for(k=0;k<m;k++){
c[i][j]=c[i][j]+ATA[i][k]*A[k][j];
}
}
}
for(i=0;i<n;i++){
for(j=0;j<n;j++){
cout<<c[i][j]<<" ";
}
cout<<endl;
}
}
int main(){
int m,n,i,j;
cin>>m;
cin>>n;
int A[m][MAX],ATA[n][MAX];
for(i=0;i<m;i++){
for(j=0;j<n;j++){
cin>>A[i][j];
}
}
compute_matrixtranspose_matrix_product (A,m,n,ATA);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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;

void transposematrix_matrix_product(int a[][100],int m,int n,int at[][100]){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
at[i][j]=a[j][i];
}
}
int p[n][n];
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
p[i][j]=0;
for(int k=0;k<m;k++){p[i][j] = p[i][j] + at[i][k]*a[k][j];}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<p[i][j]<<" ";}
cout<<endl;}

}


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

int at[100][100];

transposematrix_matrix_product(a,m,n,at);

}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 20
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];}
  }
for(int i=0;i<n;i++)
 {for(int j=0;j<n;j++)
   {for(int h=0;h<m;h++)
     {AtA[i][j]+=At[i][h]*A[h][j];}
   }
 }
for(int i=0;i<n;i++)
{for(int j=0;j<n;j++)
  {cout << AtA[i][j] << " ";}
  cout << endl;
}
}//end of function
int main()
{int A[MAX][MAX];int AtA[MAX][MAX];
int m,n;
cin >> m;
cin >> n;
for(int i=0;i<n;i++)
 {for(int j=0;j<n;j++) AtA[i][j]=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 and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 compute_matrixtranspose_matrix_product (int H[][MAX], int m, int n, int J[][MAX])
	{
	int c[n][n];
	for ( int  a=0 ;a< n ; a++ )
		{
		for (int b=0 ; b<n ; b++)
		{
		c[a][b]=0 ;
		for (int k=0 ; k<m ; k++ )
		{
	 	c[a][b]=c[a][b] + H[a][k]*J[k][b] ;
		}
		}
		}
	for (int q=0;q<n;q++) {
	for (int w=0;w<n;w++) {cout << c[q][w]<< " " ; }
	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] ;
		}
	}

int B[n][MAX] ;

for ( int x=0 ; x<n;x++ )
{
for ( int y=0 ; y<m;y++ )
{
B[x][y] = A[y][x] ;
}
}

compute_matrixtranspose_matrix_product ( B , m , n , A ) ;

}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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], int m, int n, int At[][MAX])
{
int C[n][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]+At[i][k]*A[k][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)cout<<C[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<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: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 M 100
void get (int A[][M], int n1, int n2){
int i,j;
for(i=0;i<n1;i++){
		for(j=0;j<n2;j++){
			cin >> A[i][j];
		}
}
}
void print (int A[][M], int n1, int n2){
int i,j;
for(i=0;i<n1;i++){
		for(j=0;j<n2;j++){
			cout << A[i][j] << " ";
		}
		cout << endl;
}
}
void transpose(int A[][M],int AT[][M],int m,int n){
int i,j;
for(i=0;i<m;i++){
		for(j=0;j<n;j++){
		AT[j][i]=A[i][j];
		}
		
}
}
void compute_matrixtranspose_matrix_product (int A[][M], int m, int n, int ATA[][M]){
int AT[n][M];
transpose(A,AT,m,n);
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];
			}
} 
} 
print(ATA,n,n); }

int main(){
int m,n;
cin>>m>>n;
int A[m][M];
get(A,m,n);
int ATA[n][M];
compute_matrixtranspose_matrix_product(A,m,n,ATA);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
Rating D: 0
Assigned grade: C
Problem: Write a C++ program to take the dimensions of a matrix (m,n) as input from the user. The program should then take the matrix (let us call it A) itself as input from the user. Following this, the program should compute the product of the transpose of A with A (i.e. ATA of size n x n) and display the result. To accomplish this task, write a function of the form void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]).

Constraints
n is a positive integer, m,n <= 8

Student submission:
#include <iostream>
using namespace std;
#define MAX 100

void compute_matrixtranspose_matrix_product(int a[][MAX], int m, int n, int ata[][MAX])
{int at[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[m][MAX], ata[n][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 and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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], 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[i][k]*A[j][k];
			}
		}
	}
}


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

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

int main(){
	int m,n;
	cin >> m >> n;
	int A[m][MAX],ATA[n][MAX];
	arrinput(A,m,n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	arrprint(ATA,n,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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],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[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;
cin>>m>>n;
int A[MAX][MAX];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: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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<simplecpp>
const int MAX=10;
void input(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 display(int n,int A[][MAX]){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<A[i][j]<<" ";}
cout<<endl;}
}
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]));
}
}
}
}
main_program{
int m,n;
cin>>m>>n;
int A[MAX][MAX];
int ATA[MAX][MAX];
for(int i=0;i<MAX;i++){
for(int j=0;j<MAX;j++){
A[i][j]=0;ATA[i][j]=0;
}
}
input(m,n,A);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
display(n,ATA);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
#include<cmath>
#define MAX 500
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[MAX][MAX];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
Prod[i][j]=0;
}
}
for(int i=0;i<m;i++)
{

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


}


int main()
{
int m,n;
cin>>m>>n;
int arr[MAX][MAX];
int arrt[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,arrt);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 inp(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<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];
			}
		}
	}
}

void printmatrix(int ATA[][MAX], int m, int n )
{
	for(int i = 0; i<m; i++)
	{
		for(int j = 0; j<n; j++)
		{
			cout << ATA[i][j] << " ";
		}
		cout << '\n';
	}
}
int main()
{
	int m, n;
	cin >> m >> n;
	int A[MAX][MAX]; int ATA[MAX][MAX];
	inp(A, m, n);
	compute_matrixtranspose_matrix_product(A,m,n,ATA);
	printmatrix(ATA, n, n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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>
#include<cmath>
#include<cstdlib>
#include<cstring>
#define MAX 100
using namespace std;

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 << endl;}
}

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 compute_matrixtranspose_matrix_product (int A[MAX][MAX], int m, int n, int ATA[MAX][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 >>n;
int A[MAX][MAX];
int ATA[MAX][MAX];
input(A,m,n);
compute_matrixtranspose_matrix_product(A,m,n,ATA);
output(ATA,n,n);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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<simplecpp>
#define maxsize 100
void inparr(int a[][maxsize],int m, int n){
for (int i=0; i<m; i++){
for (int j=0; j<n; j++){
cout<<"enter row"<<i<<"enter coloumn"<<j<<"value";
cin>>a[i][j];
}
}cout<<endl;
}
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<<endl;
}outarr(a,n,m);
}
void matrixmul (int a[][maxsize], int b[][maxsize], int m,int n){
int c[m][maxsize];
for(int i=0; i<m; i++){
for (int j=0; j<n; j++){
for (int k=0; k<n; k++){
 c[i][j] += a[i][k]*b[k][j];
}}cout<<endl;
}outarr (c,n,n);
}
main_program{
int m ;int n;
cin>>m>>n;
int a[m][maxsize], b[n][maxsize];
{
for (int i=0; i<m; i++){
for (int j=0; j<n; j++){
cin>>a[i][j];
b[j][i]=a[i][j];
}
}
outarr(b,n,m);
matrixmul (a,b,m,n);

}
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
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 500
void compute_matrixtranspose_matrix_product (int A[][MAX], int m, int n, int ATA[][MAX]){
	int c[MAX][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++){
			c[i][j]=0;
			for (int k=0;k<m;k++){
				c[i][j]+=ATA[i][k]*A[k][j];
			}
		}
	}
	for (int i=0; i<n;i++){
		for (int j=0;j<n;j++){
			cout<<c[i][j];
			if (j<n-1) cout<<" ";
		}
		if (i<n-1) cout<<endl;
	}
}
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];
		}
	}
}
int main(){
	int m,n;
	cin>>m>>n;
	int A[MAX][MAX];
	int ATA[MAX][MAX];
	inputmatrix(A, m,n);
	compute_matrixtranspose_matrix_product(A, m, n, ATA);
}

Grading criterion: quality and number of comments
Rating A: Well commented
Rating B: okay commented
Rating C: poor or no comments
Rating D: 0
Assigned grade: C