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
| #include <iostream>
using namespace std;
int plusGrand2(int* tableau, const int LONGUEUR, int plusGrand);
const int LONGUEUR = 20;
void main()
{
int tableau [20] = {1, 2, 6, 5, 2, 1, 9, 8, 1, 5, 15, 2, 6, 5, 2, 1, 9, 8, 1, 5};
int plusGrand = 0;
plusGrand = plusGrand2(tableau, LONGUEUR, plusGrand);
system ("pause");
}
int plusGrand2 (int tableau, int plusGrand)
{
for (int i = 1; i < LONGUEUR + 1; i++)
{
if (tableau[i] > tableau[i - 1])
{
plusGrand = tableau[i];
}
}
return plusGrand;
} |
Partager