1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| #include<iostream>
#include <cstdlib>
using namespace std;
void nombredesZero(int **A)
{
int n = 0;
for (int j = 0; j < 4; j++)
{
for (int i = 0; i < 4; i++)
{
if (A[i][j] == 0)
{
n++;
}
}
cout << "Nombres Des Zeros Pour la Colonne n°" << j << "est: " << n << endl;
}
}
int main()
{
int **A;
int t[4][4] = { { 0, 1, 2, 3 }, { 0, 2, 3, 5 }, { 0, 1, 4, 0 }, { 0, 0, 0, 2 } };
A = new int*[4];
for (int i = 0; i < 4; i++)
{
A[i] = new int[4];
for (int j = 0; j < 4; j++)
{
cout << "Donner A[" << i + 1 << "][" << j + 1 << "]" << endl;
cin >> A[i][j];
}
}
system("cls");
cout << "\n affichage" << endl;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
cout << A[i][j] << "\t";
}
cout << "\n";
}
nombredesZero(A);
nombredesZero(t); // le probleme ici :(
} |
Partager