Question: Why am I getting the following error when Declaring and Initializing C++? My Code is correct and runs so why am I getting the Code

Why am I getting the following error when Declaring and Initializing C++? My Code is correct and runs so why am I getting the Code Pattern Incomplete mark?

Why am I getting the following error when Declaring and Initializing C++?

PROJECT INSTRUCTIONS

1. Declare a constant named YEAR, and initialize YEAR with the value 2050.

2. Edit the statement myNewAge = myCurrentAge + (2050 currentYear) so it uses the constant named YEAR.

3. Edit the statement cout

MY CODE SNIP;

// This program calculates your age in the year 2050

// Input: None

// Output: Your current age followed by your age in 2050

#include

using namespace std;

int main() {

int myCurrentAge = 27;

int myNewAge;

int currentYear = 2023;

// Declaring a constant name YEAR and initializing it with 2050

const int YEAR=2050;

// Edited statements

myNewAge = myCurrentAge + (YEAR - currentYear);

cout

cout

return 0;

}

Tasks \begin{tabular}{l} NewAge2.cpp + \\ \hline 1 // This program calculates your age in the year 2050 \\ 2 // Input: None \\ 3 // Output: Your current age followed by your age in 2050 \\ 4 \end{tabular} using namespace std; 3 out of 4 checks passed. Review the results below for more details. Checks int main() \{ Code Pattern Incomplete Initialize YEAR int myCurrentAge =27; int myNewAge; int currentYear =2023; // Declaring a constant name YEAR and initializing it with 2050 const int YEAR =2050; Description Searched your code for a specific pattern: // Edited statements cout "My current Age is "

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!