There is two parts to the code, the first which I have worked out with my very basic knowledge of C++. The second part is suppose to compute the total cost of four years of tuition STARTING ten years from now. The first part of the code asks the user to input amount of first years tuition and input the inflation rate and display only ten years worth of tuition plus inflation added each year. I've worked that part out but am completely lost on how to display only the total of four years of tuition beginning ten years from now. Can anyone help, even a hint will suffice. Thank you in advice. Code follows:
This may or may not work, but try declaring an unsigned integer in place of the 10 in the for loop (to represent # of years in college) and after l. 15, try this:
1 2 3 4 5
cout << "Enter number of years in college: ";
cin >> /* name of unsigned int */
...
for(int year = 2; year <= /* name of uns. int */; year++)
...
Unless the "year" variable rep's the # of years in college. If so, then...
I'm lost.
The variable year returns year 1 through the input I added to the for statement. I thought it would work like you suggested but gave me over 102 errors every time. Thanks though.
More than 102, new record. LOL
Well, sorry.
Is it supposed to return 1? If not, scrap my idea and change "year <= 10" to "year < 11".
If not that, wait a little while and an expert will help.
Yeah my computer freaked out a little.
Tried the second solution with no luck.
eek! I'm about to pull my hair out. I've only had two weeks of experice.
I need an expert handy 24/7. haha
Hi, the code you alreay have ends with tuition equal to the fee 10 years from now, so what you need to do is loop for 3 more years, and sum the values for those years (plus the final tuitition total from your existing loop).
You can simply make your existing loop run for three more itterations, and put an if statement inside to output hte yearly value if years 2-10, or sum if years 10-13.