Help with modules
I've just started to write this program to learn modularity, but I already know I'm going to have trouble writing it. I'm asked to write a function named totamt() that accepts four integer arguments named quarters, dimes, nickels, and pennies in a piggybank. The function should determine and return the dollar value of the number of quarters, dimes, nickels, and pennies past through it.
In the program so far I have:
void totamt(int,int,int,int);//the function prototype
int quarters,dimes,nickels,pennies;//declares values as integers
printf("Enter the number of quarters: \n");
printf("Enter the number of dimes: \n");
printf("Enter the number of nickels: \n");
printf("Enter the number of pennies: \n");
I'm currently rereading the chapter Modularity Using Functions: Part 1 so I'll be able to comprehend the material better to write this program. Also, for this program will I need to use function stubs.
Please try to wrap your code into code tags like this
[key]your Code goes here[/key] Replace key with code in order this to work
Shows you how to start with an idea in main, then modularise it so specific items of functionality (like say, readUserInput) are in separate functions (and in larger projects, separate files).
This looks more like C to me than C++. Tell me, which language is it that you truly are trying to learn (or want to learn)?