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
| //Ex3
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<iomanip.h>
void saisie(float &rayon)
{
cout<<"Entrez le rayon de la sphere en cm\n";
cin>>rayon;
}
float VOL_SPH(float rayon)
{
float vol;
vol=(4*3.14159*pow(rayon,3))/3;
return vol;
}
void edition(float rayon, float vol)
{
cout<<"La sphere de rayon "<<rayon<<" cm, a un volume de "<<setprecision(2)<<vol<<" cm cube\n";
}
void main()
{
clrscr();
float rayon, vol;
saisie(rayon);
vol= VOL_SPH(rayon);
edition(rayon, vol);
getch();
} |
Partager