Simple Question:
how would I write a C++ program that converts an age in years to the age in days?
I seem to be getting an error and I'm not sure what the errorf is or how to solve it.
1
Expert's answer
2011-10-11T08:47:55-0400
#include <iostream>
using namespace std;
void main(void){ int age = 0; int dayOffset = 0; int days = 0; cout << "Please, enter an age: "; cin >> age;
dayOffset = (int)age / 4; days = age * 365 + dayOffset;
cout << "Age in days: " << days << endl; cout << "\nInput 0 and press Enter exit..."; cin >> dayOffset; }
Comments
Leave a comment