Home > Back-end >  Ask a question
Ask a question

Time:12-23

Suppose your id have balance (make) 50 yuan, to the four classmates, please eat (each one a cover to the school canteen pouring
Rice),
Please use a loop to realize:
(1) of each loop, screen prompts "please input the consumption amount of this order:"
(2) from the keyboard input the consumption amount (xf), if the balance (make) enough, the screen shows "success", shows the balance at the same time, into the next cycle, is a classmate of the check,
(3) if in one payment, the balance is insufficient, the prompt "top-up balance is not enough, the consumer can not complete please!" , and at the same time, jump out of the loop, you treat the upload fails, a bit embarrassing, haha,
(4) the final output, if all students order success,
Show "too happy, finally can eat!" If you have any classmate all order success, do not upload shows "didn't eat rice and * a file, I am unable to big!

CodePudding user response:

Use a for loop and then balance minus break next time you're spending less than zero; Order statistics can be successful in the middle
  • Related