All pastes #346110 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-09 02:11 UTC
rendered paste body
int indiceMaxi(double aChercher, double numero[], int nbJou)
{
  for (int i = 0; i < nbJou; i++)
    if (numero[i] == aChercher)
      return i;
  return -1;
}


void determinerMax(int chandail[], double taille[], double poids[], int naissance[],
		   int position[], string nomPre[], int & n, char code)		
{
  double  maxi;
  int indice;
  if (code == 'p')
    {
      maxi = poids[0];
      for (int i = 1; i < n; i++)
	{
	  if (poids[i] > maxi) maxi = poids[i];
	}
      indice = indiceMaxi(maxi, poids, n);
      cout << "Joueur le plus lourd de l'équipe : \n";
    }
  else
    {
      maxi = taille[0];
      for (int i = 1; i < n; i++)
	{
	  if (taille[i] > maxi) maxi = poids[i];
	}
      indice = indiceMaxi(maxi, taille, n);
      cout << "Joueur le plus grand de l'équipe : \n";
    }
     
  /* afficher le point de décimal */
  cout.setf(ios::showpoint);
  
  /* afficher la partie décimale en mode point flottant fixe */
  cout.setf(ios :: fixed);
  
  cout << "Rang Chandail Taille Poids Naissance Position Nom et Prenom"
       << endl;
  cout << setw(3) << indice << ") " << setw(5) << chandail[indice]
       << setw(9) << setprecision(3) << taille[indice] << setw(7)
       << setprecision(2) << poids[indice] << setw(7) << naissance[indice]
       << setw(8) << position[indice] << setw(28) << nomPre[indice] << endl;
  cout << endl;
}