确定是否可以使用预先编号的数字和时间来编号 [英] Determine if a number can be made with prepicked numbers and times

查看:104
本文介绍了确定是否可以使用预先编号的数字和时间来编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个数组将使用的数字类型之一,第二个数组是该数字可以使用的次数。我有一封信确定将使用何种方法我需要弄清楚我可以使用一个数组中的某个数字来确定一个字母+数字'我想要用所有可用的'数字'我可以使用的数字。如果无法提供这个号码,我只想说号码不能制作或者其他任何东西,但允许程序继续前进。

这就是我所拥有的东西

I have 2 arrays one of the types of numbers that will be used and the 2nd array is how many times that number can be used. I have a letter that determines what kind of method will be used I need to figure out how many times I can use a certain number from an array to determine a letter+number The ‘number’ is what I have to make with all the available numbers I can use. If the number cannot be made I would like to just say number cant be made or anything but allow the program to move on.
Here is what I have

int[] picks = { 100, 50, 20, 10, 5, 1 };
            int[] times = { 10, 10, 10, 10, 10, 10 };
string choice = Console.ReadLine();
else if (choice.Equals("D")) {
Dispense(amt, billCounts);
}





我的尝试:



我有数字正在使用下一个数字,如果当前的数字全部用完了我已经完全正常工作了我唯一剩下的就是如果没有足够的可用选择来停止选择一定数量



What I have tried:

I have the numbers working to use the next number if the current one is all used up i have all that working fine the only thing i have left is to stop the choice if there is not enough available picks to make a certain number

推荐答案

Dim Counts(5) As Integer = {0,0,0,0,0}
Dim tmpValue as Integer
Dim tmpMessage as string
Dim tmpTest as Boolean

' Initialise
tmpMessage = ""
tmpTest = false
tmpMessage  = ""
tmpValue = Choice

'Process
Do

   '//


100
如果tmpValue> 100然后
计数(0)=计数(0)+ 1
tmpValue = tmpValue - 100
'//
100 If tmpValue > 100 Then counts(0) = counts(0) + 1 tmpValue = tmpValue - 100 '//


50
ElseIf tmpValue> 50然后
计数(1)=计数(1)+ 1
tmpValue = tmpValue - 50
'//
50 ElseIf tmpValue > 50 Then counts(1) = counts(1) + 1 tmpValue = tmpValue - 50 '//


这篇关于确定是否可以使用预先编号的数字和时间来编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆