Untitled
public text v1 · immutable// 5.c -- convert distance in light years to astronomical units
#include <iostream>
double lightyear_convert(double);
using namespace std;
int main()
{
double lightyears, ast_units;
cout << "Enter the number of light years: ";
cin >> lightyears;
ast_units = lightyear_convert(lightyears);
cout << lightyears << " light years = ";
cout << ast_units << " astronomical units." << endl;
return 0;
}
double lightyear_convert(double lightyears)
{
return lightyears * 63240;
}