Compter le nombre de répétition d’un élément dans un tableau

Author:


Download

#include 
#include 
using namespace std;

int tab[] = { 22, 22, 22, 44, 22, 55, 66, 77 };

int main()
   {
   int n = count(tab, tab+8, 22);  //Compter le nombre de 22 dans le tableau
   cout << "Il ya '" << n << "' 22 dans le tableau." << endl;
   return 0;
   }

Leave a Reply

Your email address will not be published. Required fields are marked *