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

my teddy bear gave me a hug is an example of 1.metaphor 2.personification 3.simile 4.alliteration
translate into an equation. Five times the sum of twice a number, x, and six is thirty. Find the number.x = Translate into an equation. The difference b
What is does the phrase foe to ambition.
why a flat surface of a rectangular prism called faces?
find an equation of the tangent line to the circle x^2 +y^2=24 at the point (-2 square root 5, 2).
What is 0.75 as a fraction in simplist form
Mrs.Savin receives a weekly base salary of $500,plus a commission of $1200 on each car that she sells. Write a function rule relating her total weekly pay p to
what is 1/9 of 60 equal
Three individuals form a partnership and agree too divide the profits equally. X invest -9,000 , Y invest 7,000, Z invest 4,000. How much less does X receive if
in what way is a gene pool representative of a population