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

explain how the following terms are related: element, atom, molecule, chemical bound, compound, mixture, and substance.
What is the meaning of (temporland)?
what is 4/5 times 10?
Which is true of ultraviolet rays? They help your body produce vitamin D.They are visible to the naked eye.They provide the energy that makes your morning toast
carol drives her daughter to school at an average rate of 30 miles per hour, but only goes an average rate of 20 miles per hour on the way home because of traff
Mr Wallace took 600mg of medicine. This was 75% of the full dose. What was the full dose?
How are ratios used in everyday life?
you are adding 3 2/3+2 2/3 using fraction strips explain how you rename the fraction part of the problem
4 times what equals 32
A substance that enters into a chemical reaction is called a(n) _____. enzyme reactant catalyst product