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

Match the global geographic area to their correlated amount of oil reserves. High is 9% or more of the world's oil. Moderate is 5 - 7 % and low is 4% and under.
what are the importance of computer software​
What is the name of CH3CH2CHMgBr(CH3)?​​
Assume the random variable X has a binomial distribution with the given probability of obtaining a success. Find the following probability, given the number of
a + b = c a + b + c =36 Given that a and b have the same value, work out the values of a,b and c
What is spy wear on a desk top computer
what is meaning of intence thinker?​
the mechanical advantage of a simple machine is 3 and its velocity ratio is 4 find its efficiency ​
Tan + Cos / 1 + Sin = Sec
11 Write an email You are going to write an email to a British online friend, and tell him/her about your pastimes. Use Stone 22. Tip Before you do this exercis