/home/manu/Dropbox/Projets/notes/main.cpp |
#include <iostream> #include <iomanip> using namespace std; int main() { double notes[10]; double somme = 0.0, plusHaute = 0.0, plusBasse = 20.0; unsigned nombre; cout << "Nombre de notes pour le traitement : "; cin >> nombre; cout << endl; for (unsigned i=0; i<nombre; i++) { cout << "Note n°" << i+1 << " = "; cin >> notes[i]; somme += notes[i]; if (notes[i] > plusHaute) plusHaute = notes[i]; if (notes[i] < plusBasse) plusBasse = notes[i]; } cout << endl; cout << "Notes : ["; for (unsigned i=0; i<nombre; i++) cout << notes[i] << ' '; cout << "\b]\n" << fixed << setprecision(2); cout << "Moyenne :" << setw(10) << somme / nombre << endl; cout << "Plus haute :" << setw(10) << plusHaute << endl; cout << "Plus basse :" << setw(10) << plusBasse << endl << endl; return 0; }