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

There are two ways of adding two square numbers to make 65. Write a different square number in each box. [ ] + [ ].
how to solve 0.01x+0.07y=0.22 and 0.03x-0.05y=0.14 by substitution
help me with this french hw plzz
what are the effects of global warming
how many 5/8 pound bags does it take to make 13 pounds of soil?
Stan works on an assembly line. What effective and appropriate approach would he be wise to use when coping with minor frustrations like hang-ups on a conveyor
On a TI-84, how do you stop it from giving you simply a number for an answer when you put in a polynomial divided by another polynomial?
A 75 force is applied to the side of a crate resting on a level floor. The crate has a mass of 25kg. If the coefficient of static friction is .15, is the 75 N f
what are three physical properties of aluminum foil
How do i find the greatest common factor of 150, 275, and 420 ??