Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void insMatrice(int m[][10], int righe, int colonne) {
- int i=0, j;
- for (i=0; i<righe; i++) {
- for (j=0; j<colonne; j++) {
- cout << "M[" << i << "][" << j << "] = ";
- cin >> m[i][j];
- }
- }
- }
- int main(int argc, char **argv)
- {
- int m[10][10];
- int righe=0, colonne=0;
- do {
- cout << "Righe = ";
- cin >> righe;
- if ( (righe<1)||(righe>10) ) {
- cout << "Errore, riprova!" << endl;
- }
- }while( (righe<1)||(righe>10) );
- do {
- cout << "Colonne = ";
- cin >> colonne;
- if ( (colonne<1)||(colonne>10) ) {
- cout << "Errore, riprova!" << endl;
- }
- }while( (colonne<1)||(colonne>10) );
- cout << endl;
- insMatrice(m, righe, colonne);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement