68 369
Assignments Done
98,7%
Successfully Done
In November 2018

Answer to Question #4508 in C++ for Azi Amar

Question #4508
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.
Expert's answer
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions