|
The differences aren't that big (not in this program anyway) a few pointers are:
#include <stdio.h> is changed to #include <iostream>
Since you're working with C++ you need to declare the namespace you want, so remember
using namespace std;
printf() is changed to cout <<
fgets() is changed to cin.getline()
fscanf() is changed to cin >>
But since Valmont provided you with quite a nice foundation, I would suggest you'd use that as your foundation. There the parking_cost/student_sticker_refund/enrolment_cost is using the same logic as student_service_cost() and they just need to be combined with some sort of userinterface, where the user is questioned and uppon that the total cost gets calculated.
The differencies in Valmont and my suggestion, is that mine is filled with alot of error checking, to make sure the user dosn't provide us with input that wouldn't be usefull in the calculation, but since Valmonts isn't providing you with the userinterface (altho the code dos give some hints) he dosn't need to provide that.
Mine is designed on the use of pointers and arrays, since I thought that would be the easiest way of representing the cost for fall/spring/summer/winter parking/enrolment etc. without alot of variables floating around.
Since you mentioned that you'd probably wasn't supposed to use any of that, my version might be a week longer into your course than expected, but on the other hand, it does mention some function using parse by reference and parse by value. Since my get_user_input() uses both, those requirements are met.
|