Can't figure out how to write to tell someone who is a certain age what their next decade would be in a certain amount of years. ie. say is someone was 23, how would i write that in 7 years they would be in their 3 decade?
// HowOld.cpp : main project file.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(array<System::String ^> ^args)
{
// Have the user enter their age
cout << "Please enter your age and prepare to have your mind blown! ";
int age;
cin >> age;
// Tell them how old they will be in a year
int nextYear = age +1;
// Report to the user how many decades old they are Done with the entered age
int decadesAge = age /10;
// Report to the user how many more years until they reach the next decade
// Display results
cout << "In a year you will be " << nextYear << " WOW! YOU'RE OLD!\n"
"Right now you are in decade " << decadesAge << " of you life.\n";
use modulo to find out how many years have already passed since the last decade: age % 10
(this will give you number 3 - it's the remainder of division 13 / 10)
and the only thing you have to do now is subtract the remainder (3) from number 10
---> result = 7
You might need to think about this. If you are, say 5 years old, what decade of you life are you in? It is different to how many decades you have lived.