So far this is what i have. I have to take a persons name and age in earth years and convert it to Martian years.
These are the Requirements the code must meet----
Your program must also meet these requirements:
Asks the user for their name and displays it back out in a welcome message. Must use getline() function to accommodate for spaces in the name.
Include comments with your name and date
Uses comments to explain the code
Uses a constant value for the Martian year of 1.88
The Martian result is displayed out to exactly 2 decimal places.
All variables and constants must be defined and initialized at the beginning of the main() function.
Be sure to check your math with various test data. For example:
20 years = 10.64 Martian years
22 years = 11.70 Martian years
30 years = 15.96 Martian years
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <cstdlib>
#include <iostream>
# include <string>
using namespace std;
int main(int argc, char *argv[])
{
cout << "Calculate Your Martian Age!" << endl;
cout << "Enter your name to get startred." << endl;
string FirstLine;
getline(cin, FirstLine);
cout << "How old are you in Earth Years?" << endl;
string SecLine;
getline(cin, SecLine);
system("PAUSE");
return EXIT_SUCCESS;
|