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

Tony's Pizza made 52 pizzas today. If each pizza contains 12 slices, estimate how many slices of pizza Tony's Pizza Place made by rounding both numbers to the n
Kong took 15% fewer seconds than Nolan took to complete his multiplication timed test. Kong took 85 seconds How many seconds did Nolan take?
(x^3)^2=x^6 true or false
What value of x is in the solution set of -5x – 15 > 10 + 20x?
Find the sum. Write your answer in scientific notation. (2×105)+(3.8×105)=
The narrator MOST LIKELY thinks the house is A. a stimulating and distracting place. B. a dull and suffocating place. c. an average and forgetable place. D. a l
Which expression is equal to 6(−3)4 6 ( - 3 m ) ?
What are some parts of a food chain and a food web
Can somebody help me
Tengo ojos per no veo agua pero no bebo