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

Which points are collinear with A and N?
Write the diameter of an atom 1 x 10-8 cm in standard form
Epithelia are strong membranes that function to bind the body together a. True b. False
Groups of atoms that are added to carbon backbones and give them unique properties are known as
Based on climate change: an overview, what are the effects of global climate change?
Many scientists believe that the disappearance of the dinosaurs was due to a(n) ____________
How many meters are in 2.4 km?
Ow does water enter the atmosphere? a. liquid water evaporates from lakes when heated by the sun. b. frozen water sublimates from ice and snow. c. liquid water
Steve received an e-mail from his friend, lindsay, about a party she is throwing later this month. in the e-mail, lindsay writes, "you better be there!" steve i
thx, 5 star and brainliest for first