Created
April 14, 2013 02:22
-
-
Save radamant/5381106 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#define ASTRO_UNITS_PER_LIGHT_YEAR 63240 | |
float lightYearsToAstronomicalUnits(float); | |
int main() | |
{ | |
using namespace std; | |
cout << "Enter the number of light years: "; | |
float lightYears; | |
cin >> lightYears; | |
cout << lightYears << " light years = " | |
<< lightYearsToAstronomicalUnits(lightYears) | |
<< " astronomical units." << endl; | |
return 0; | |
} | |
float lightYearsToAstronomicalUnits(float lightYears) | |
{ | |
return lightYears * ASTRO_UNITS_PER_LIGHT_YEAR; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment