把具体的行txt为数组 [英] Put specific line of txt in array
问题描述
我想提出一个谁想成为百万富翁游戏,我的C#类,我有15 txts,每3个问题/解答。
例如:
I am making a "Who wants to be a millionare" game for my c# class, and I have 15 txts with 3 questions/answers each. example:
请告诉我巴西的首都? ||里约热内卢||巴西利亚||圣保罗|| Curitibia ||巴西利亚||
我想这个问题存储到一个数组 [0,0]
,并在下一位置的答案 [0,1]
到 [0,5]
。
I want to store the question into an array [0,0]
, and the answers in the next positions [0,1]
to [0,5]
.
我如何做到这一点的每一个TXT文件中的3个问题?
How do I do this for the 3 questions on every txt file?
感谢您
推荐答案
我不认为我们在技术上要回答的问题的功课,所以我会在正确的方向指向你:谷歌。试着输入'C#多维数组,并寻找链接到MSDN库。有样品的相当多,可以适应你的目的。
I don't think we're technically supposed to answer homework questions, so I shall point you in the right direction: Google. Try inputting 'C# multidimensional array' and looking for the link to the MSDN library. There are a fair number of samples that can be adapted to your purpose.
请注意,上面的批评家是对的;最常见的编程,你不会找到用于项目分工和比较逗号小数。我知道欧洲风格的数字用逗号表示做在美国和反之亦然什么小数,但据我所知,大多数编程语言的设计与美式英语的初衷。这意味着,2.25装置2和四分之一,其中,2,25表示的2和25的列表。
Note that the commenter above is right; most often in programming you won't find decimals used for item division and rather commas. I know European-style numbers use commas to denote what decimals do in the US and vice-versa, but to my knowledge most programming languages were designed with American English in mind. This means that 2.25 means 2 and one quarter, where 2,25 indicates a list of 2 and 25.
这篇关于把具体的行txt为数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!