C++程序设计:1.12
#include<iostream>
using namespace std;
int main()
{
// 声明变量
double distance_in_miles = 24; // 距离(英里)
double time_in_seconds = 6035; // 时间(秒)
double distance_in_km; // 距离(千米)
double time_in_hours; // 时间(小时)
double speed_in_kmph; // 速度(千米/小时)
// 计算距离和时间的转换
distance_in_km = distance_in_miles * 1.6;
time_in_hours = time_in_seconds / 3600;
// 计算速度
speed_in_kmph = distance_in_km / time_in_hours;
// 输出结果
cout << "The average speed of the runner is " << speed_in_kmph << " km/h." << endl;
return 0;
}