//Archimedes
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
const double y = 62.4;
const double pi = 3.1415926;
double weigth,radius,volume,fb;
cout<<"输入球的重量和半径:\n";
cin>>weigth>>radius;
volume = (4.0/3)*pi*pow(radius,3);
fb = y * volume;
if(weigth > fb)
cout<<"The ball will sink!\n";
else
cout<<"The ball will float!\n";
return 0;
}
Archimedes
转载于:https://blog.51cto.com/9320314/1544922