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

Can I please get steps please
The blades of a windmill turn on an axis that is 35 feet above the ground. The blades are 10 feet long and complete two rotations every minute. Which of the fol
need help asap!!!The probability of winning a game is 60%. How many times should you expect to win if you play 20 times?(A)12(B)16(C)8(D)2
In DNA, what base pairs with cytosine?adeninecytosineguaninethymine​
Need help !!!!! ASAP
A war between citizens of the same country that takes place within that country is known as a civil war
primera clase y segunda clase son dos tipos de
In what state would you find the tallest mountain east of the mississippi river?
Can someone help me with this one please thank you
the APR on leslie's credit card is currently 21.6%. what is the monthly periodic rate?