I need to switch the work from main () to the userspec() function but it is going horribly. Can anyone guide me in the right direction? This is due today and I spent a week trying to figure it out.
Could you please be a little bit more specific about the problems you encounter? Does the code not compile, are you getting errors when the program is running, if so, which errors do you get, etc.
Hey, thank you for responding. The program runs perfectly but I wrote everything in the userspec function that should actually be under the main function. So I want to move the code around and make it correctly written.
I am struggling with learning functions, can't quite grasp them yet.
The idea behind functions is mostly to be able to reuse certain bits of code easily. They also give you small entities which have one specific task. This makes code more clear, readable and more modular.
In your program, you could, for instance have following functions (I've exaggerated a little bit to make the point clear):
print_welcome();
get_spools_to_order(int& orderchoice);
get_spools_in_stock(int& stockleft);
get_shipping(int& shipandhand);
process_order(); //pass necessary variables for these two too of course
print_result();
More information about functions is available here:
http://www.cplusplus.com/doc/tutorial/functions/
http://www.cplusplus.com/doc/tutorial/functions2/