KaiDeguzzy3774 KaiDeguzzy3774
  • 02-07-2020
  • Computers and Technology
contestada

In this lab, you declare and initialize constants in a C++ program. The program, which is saved in a file named NewAge2.cpp, calculates your age in the year 2050.

Respuesta :

frknkrtrn
frknkrtrn frknkrtrn
  • 07-07-2020

Answer:

#include <iostream>

using namespace std;

int main()

{

   const int YEAR = 2050;

   int currentYear = 2020;

   int currentAge = 38;

   

   cout<<"You will be " << currentAge + (YEAR - currentYear) << " years old in " << YEAR;

   return 0;

}

Explanation:

Initialize the YEAR as a constant and set it to 2050

Initialize the currentYear as 2020, and currentAge as 38

Calculate and print the age in 2050 (Subtract the currentYear from the YEAR and add it to the currentAge)

Answer Link

Otras preguntas

solve for u 2- 5/6u is less then -3
What two things should Zara keep in mind to make sure that the food her restaurant serves is free of chemical contaminants?
What fair exhibit did Lieutenant Mason A. Schufeldt travel to Zanzibar to find? a) giraffes b) Zulus c) pygmies d) chocolate that will not melt
PLEASE HELPP MEEEE How does the writer use language here to describe the setting of the city?
The first time you get an infection, your immune system responds the same infection again, your immune system responds If you become re-infected with A. quickly
You are asked to make an important decision about your fitness, health, or well- ness. How would you use the scientific method to make that decision?
I need help with this question
Plzzzzzzzzz helppppppppp
Which word has the most negative connotation? a.say b.indicate c.express d.tattle
4y-4x=28 slope intercept form