09/01/04 12:53:22
修正
#include <iostream>
using namespace std;
#include <math.h>
void atai();
int main()
{
cout<<"こんにちわ。"<< endl;
atai();
return 0;
}
void atai()
{
double v;/*v=物体の速さ*/
double undou;/*運動する物体の時間の刻み*/
double c = 1080000000;/*光の速さ*/
cout<<"物体の速さ入力:(km/h)";
cin>>v;
if(1 <= v && v <= 1080000000 ){
double ruto;
ruto = sqrt(1 / (1.0000000 - (v/c) * (v/c)));
undou = ruto;
cout<<"物体の時間の刻み"<<undou<<endl;
cout<<"静止している物体が1年間すごしている間"<<endl;
cout<<"運動している物体は"<<1 / ruto<<"年間過ごしてる"<<endl;
}
else{
cout<<"光の速さを超えることはできません"<<endl;}
}