Help me fix the errors. Problem: For a given 8 by 8 matrix, find k such that the k-th row of the matrix coincides with the k-th column. Find the sum of the elements in those lines that contain at least one negative element. Help me fix errors
#include <iostream> #include <conio.h> #include <ctime> #include <stdlib.h> #include <iomanip> using namespace std; int main() { srand(time(0)); int A[8][8],k,i,j,S=0,z; for (i=0;i<8;i++) { for ( j=0;j<8;j++) { A[i][j]=rand()%20-5; } } for (i=0;i<8;i++) for (j=0;j<8;j++) { cout<<setw(8) <<A[i][j]<<" "; } for (i=0;i<k;i++) { k=0; for (j=0;j<k;j++) if(A[i][j]==A[j][i]) k++; if(k==3) cout<<"k="<<i; } for (i=0;i<8;i++) { for (j=0;j<8;j++) { if(A[i][j]<0) { S+=A[i][j]; } } cout<<"\nSuma elementov v "<<i+1<<" = "<<S<<endl; S=0; } getch (); return 0; }