Declare a constant named YEAR, and initialize YEAR with the value 2050. Edit the statement myNewAge = myCurrentAge + (2050 − currentYear) so it uses the constant named YEAR. Edit the statement cout << "I will be " << myNewAge << " in 2050." << endl; so it uses the constant named YEAR.#include
using namespace std;
int main()
{
int myCurrentAge = 29;
int myNewAge;
int currentYear = 2014;


myNewAge = myCurrentAge + (2050 - currentYear);

cout << "My Current Age is " << myCurrentAge << endl;
cout << "I will be " << myNewAge << " in 2050." << endl;

return 0;
}
looking for code pattern

Respuesta :

Answer:

The following edits will be made to the source code

const int YEAR = 2050;

cout << "I will be " << myNewAge << " in "<<YEAR<<"." << endl;

Explanation:

First, YEAR has to be declared as an integer constant. This is shown as follows;

const int YEAR = 2050;

This will enable us make reference to YEAR in the program

Next,

Replace the following:

cout << "I will be " << myNewAge << " in 2050." << endl;

with

cout << "I will be " << myNewAge << " in "<<YEAR<<"." << endl;

I've added the edited source file as an attachment;

Ver imagen MrRoyal