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

How do i solve this?
how much of louisiana was flooded in the flood of 1972? A. one quarter of Louisiana B. none of Louisiana was flooded C. half of Louisiana D. all of Louisiana
What is the straight line distance in miles from indianapolis, indiana to nations capital?
An allusion is a reference, in a literary work, to another work by an author. True False
X over 15 = 10 over 20
What group of tissue has two types, soft and hard, and holds body parts together?
1. Choose the correct answer to complete each sentence. Ayer yo ___ a la playa con mis amigos. iba iré fui fue 2. Choose the correct answer to complete ea
During which time or stage of development can diet influence gene function and impact healthy food habits of a child
Which statement comparing fractions is true? A) 3 10 < 3 5 B) 4 9 > 4 7 C) 5 8 > 5 7
How many strands of mrna are transcribed from the two unzipped strands of dna?