Respuesta :
Answer:
#include <iostream>
using namespace std;
int main()
{
int myNewAge;
int myCurrentAge = 29;
int currentYear = 2020;
myNewAge = myCurrentAge+(2050-currentYear);
cout<<"My Current Age is "<<myCurrentAge<<". I will be "<<myNewAge<<" in 2050"<<endl;
return 0;
}
Explanation:
The program is written in C++ language as required. firstly, we declare the three variables:
int myNewAge;
int myCurrentAge = 29;
int currentYear = 2020;
Then we calculate the new age as: myNewAge = myCurrentAge+(2050-currentYear);
Using multiple cout operators ( <<) we display the output nicely as required by the question with this statement
cout<<"My Current Age is "<<myCurrentAge<<". I will be "<<myNewAge<<" in 2050"<<endl;
To make corrections to your code, implies that we debug the code. The following are the reasons why your code is not working.
The errors in the code is quite much, so I will rewrite the program, where comments are used to explain difficult line of the program
#include<iostream>
using namespace std;
int main(){
//This declares all variables
int myCurrentAge, myNewAge, currentYear;
//This initializes currentYear to the current year
currentYear = 2021;
//This initializes myCurrentAge to your current age
myCurrentAge = 20;
//This calculates your new age
myNewAge = 2050 - 2021 + myCurrentAge;
//This prints the calculated new age
cout<<"My new age: "<<myNewAge;
return 0;
}
Read more about debugging at:
https://brainly.com/question/23527739