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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| #include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double Aire;
double Volume;
double rayon = 0;
/*Calculer l'aire d'une sphère de rayon*/
cout << "Entrez le rayon(en centimetre(s) de la sphere?" << setw(10) << "cm" <<endl;
cin >> rayon;
Aire = 4 * 3.14159 * pow(rayon,2);
cout << "L'aire du sphere est:" << setw(12) << Aire << endl << endl;
/*Calculer le volume d'une sphère de rayon*/
Volume = 4 * 3.14159 * pow(rayon,3)/3;
cout << "Le volume de la sphere est:" << setw(10) << Volume << endl << endl;
}
int menu();
void calculeAire();
void calculeVolume();
{
int choix = menu();
switch(choix)
{
case 1: calculeAir();
break;
case 2: calculeVolume();
break;
default:cout << ("Quitter") << endl;;
}
}
int menu()
{
int choix;
cout << " 1: calculeAire" << endl;
cout << " 2: calculeVolume " << endl;
cout << " 0: Quitter " << endl;
cout << " votre choix " << endl;
cin >> choix;
return (choix);
} |
Partager