The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 408 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
DECLARING AND INITIALIZING C++ VARIABLES In this lab, you declare and initialize variables in a C++ program provided with the data files for this book. The program, which is saved in a file named NewAge.cpp, calculates your age in the year 2030.
Â
1. Open the source code file named NewAge.cpp using Notepad or the text editor of your choice.
2. Declare an integer variable named myNewAge.
3. Declare and initialize an integer variable named myCurrentAge. Initialize this variable with your current age.
4. Declare and initialize an integer variable named currentYear. Initialize this variable with the value of the current year. Use four digits for the year.
5. Save this source code file in a directory of your choice, and then make that directory your working directory.
6. Compile the source code file NewAge.cpp.
7. Execute the program. Record the output of this program.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on-----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------