Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- choice = menu();
- // Execute the appropriate choice.
- if (choice == 1) {
- dobuy(&cash, &numchips);
- }
- else if (choice == 2) {
- dosell(&cash, &numchips);
- }`
- void dosell(int *cash, int *numchips) {
- int numsell;
- // Determine the number of chips to be sold.
- printf("How many chips do you want to sell?n");
- scanf("%d", &numsell);
- // Print out the error message if this is too much.
- if (numsell > *numchips)
- printf("Sorry, you do not have that many chips. No chips sold.n");
- // Execute the transaction.
- else {
- (*cash) += sellchips(numsell);
- (*numchips) -= numsell;
- }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement