问题描述
我正在进行一项名为Pennies for Pay的课程作业
该计划的目标是接收工作天数的输入。
这应该是> 0和< = 40。
示例输出如下,您会注意到,每天的工资翻倍。
支付:$ .01在第1天。总工资$ .01
支付:第2天$ .02。总工资$ .03
支付:第3天$ .04。总工资$ .07
支付:第4天$ .08。总工资$ .15
支付:第16天$ .16。总工资$ .31
一直持续到天数。
我的程序如下:我唯一的问题是,当用户输入工作天数时,它来自那一天,一直到40,而不是从第一天开始直到工作天数。
我想我可能需要调整while循环....任何建议?
I am working on a class assignment called Pennies for Pay
the object of the program is to receive input for number of days worked.
This should be > 0 and <= 40.
An example output is below and you will notice, the pay doubles each day.
Pay: $.01 on day 1. Total Salary $.01
Pay: $.02 on day 2. Total Salary $.03
Pay: $.04 on day 3. Total Salary $.07
Pay: $.08 on day 4. Total Salary $.15
Pay: $.16 on day 5. Total Salary $.31
continue until number of days.
My program is below: The only problem I have is that when a user inputs the number of days worked, it goes from that day, all the way until 40 instead of from the first day until the number of days worked.
I think I may need to tweak the while loop....any suggestions?
推荐答案
这篇关于坚持在循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!