// Azzeramento seconda diagonale (matrice)
#include
using namespace std;
// ----- VARIABILI GLOBALI ----- //
const int massimo=100;
// ----- /VARIABILI GLOBALI ----- //
// ----- PROTOTIPI ----- //
int dimensione();
void caricamento_matrice(int [massimo][massimo], int, int);
void stampa_matrice(int [massimo][massimo], int, int);
void azzeramento(int [massimo][massimo], int, int);
// ----- /PROTOTIPI ----- //
// ----- FUNZIONI ----- //
int dimensione()
{
int n;
cout
cin>>n;
while (n>massimo)
{
cout
cin>>n;
}
return n;
}
void caricamento_matrice(int m[massimo][massimo], int nr, int nc)
{
for (int i=0; i
for (int j=0; j
cout
cin>>m[j];
}
}
}
void stampa_matrice(int m[massimo][massimo], int nr, int nc)
{
for (int i=0; i
for (int j=0; j
cout[j]
}
cout
}
}
void azzeramento(int m[massimo][massimo], int nr, int nc)
{
for (int i=0; i
for (int j=0; j
if (i+j==nr-1)
{
m[j]=0;
}
}
}
}
// ----- /FUNZIONI ----- //
// ----- PROGRAMMA PRINCIPALE ----- //
int main()
{
int matrice[massimo][massimo];
int righe=dimensione();
int colonne=righe;
cout
caricamento_matrice(matrice, righe, colonne);
cout
stampa_matrice(matrice, righe, colonne);
azzeramento(matrice, righe, colonne);
cout
stampa_matrice(matrice, righe, colonne);
return 0;
}
// ----- /PROGRAMMA PRINCIPALE ----- //