做一个食物产生器 [英] Make a foods generator

查看:74
本文介绍了做一个食物产生器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好
我想知道用C#编写的程序如何可以产生一个星期的食物,但从未重复过.
将在一周中的每一天产生投入,肉,鱼和甜点.

例如:
星期一星期二星期三星期四星期五星期六星期日
面包…………………………
鸡…………………………
沙丁鱼…………………………
菠萝…………………………

已经谢谢你了;) ....


我将扩大肯尼思所说的内容,并补充说,当使用食品时,将其从列表中删除,这样就永远不会重复.

hello
I wonder how a program in C# that could produce food for a week but never repeated.
will generate input, meat, fish and dessert for each day of the week.

eg:
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
bread ... ... ... ... ... ...
chicken ... ... ... ... ... ...
sardines ... ... ... ... ... ...
pineapple ... ... ... ... ... ...

Thank you already ;)

解决方案

All you need is a List(of Food) and a Random function... Besides you didnt tag the question on what languange you use....


I''m going to expand on what Kenneth said, adding that as a food is used, remove it from the list, so it is never repeated.


这篇关于做一个食物产生器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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