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

what is the working procedure of electric geyser
A triangle has side lengths of 5, 9 and 12. Is it right acute or obtuse?
find the exact value by using a half-angle identity. sin 22.5degrees show your work. thanks!
how to find the area of the 45-45-90 triangle with a hypotenuse of 24?
HOW MANY DIAGONALS CAN BE DRAWN FROM ONE VERTEX OF A REGULAR OCTAGON?
100 96 104 88 120 56 what is the next number in this series of numbers?
Find the volume of the largest sphere that could be enclosed in a cube with a side length of 10 cm. Round to the nearest tenth.
Find two ways to determine the number of dimes in $8.70
$5,000 is invested at 3% interest. How much money must be invested at 5% interest so that the total interest from the two investments is $275 after one year?
How were the fossil symbols and mountain belts helpful in deciding where to move the continents