C#Hangman游戏帮助 [英] C# Hangman Game Help

查看:76
本文介绍了C#Hangman游戏帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了一个月或两个月的时间在C#课程中获得帮助.全班结束了,但我想完成这本书中的问题,以继续学习尽可能多的东西.编程不是我的专业,但是那是一门愉快的课程,所以我想完成本书中的问题.如果有人可以帮助我解决这个问题,或者至少给我一个正确的方向,我将不胜感激.我对此有很多麻烦,我真的不知道该如何处理数组,而我尝试的任何方法似乎都不起作用.我实际上已经完成了Windows Forms应用程序的问题,但是我需要将其转换为控制台应用程序,但是似乎无法做到这一点,所以我想知道从头开始是否会更容易?问题如下:

1.编写类似于"Hangman"的控制台程序:
2.创建一个由10个单词组成的数组(由您决定单词).
3.从数组中随机选择一个单词.
4.然后提示用户猜测单词的字母
5.然后,如果用户的字母猜测词与单词中的任何字母匹配,则将猜测的字母放入另一个数组的适当索引中,并在此时向用户显示内容.

重复直到猜出所有字母或用户错过3次为止.
包括任何必要的错误处理.

预先感谢您的帮助.

I had been receiving help during a C# course I took a month or 2 back. The class ended but I wanted to finish the problems in the book to continue to learn as much as I could. Programming is not my major, but it was an enjoyable course so I wanted to finish the problems in the book. If anyone can help me with this problem, or at least give me a kick in the right direction, I would appreciate it. I am having a lot of trouble with it, I really don''t know what to do with the arrays and nothing I try seems to work. I actually completed a windows Forms application of the problem, but I need to convert it to a Console Application, and I can''t seem to do it so I''m wondering if it would be easier to start from scratch? Below is the problem:

1. Write a console program similar to ''Hangman'':
2. Create an array of 10 words (you decide the words).
3. Randomly select a word from the array.
4. Then prompt the user to guess a letter of the word
5. Then if the user''s letter guesses matches any letter(s) in the word, then put the letter guessed into the proper indices of another array and display the contents at this point to the user.

Repeat till either all letters are guessed or the user misses 3 times.
Include any necessary error handling.

Thanks in advance to any help.

推荐答案

Ed_t您的quest_on _dd为您_re us_n_的一些代码.在出现问题时,请spec_f_c_lly解决问题.否则,您将非常_sk_n_我们为您m_ke pro_r_m.

Ed_t your quest_on to _dd some of the code you _re us_n_. Po_nt out wh_ch l_nes you _re h_v_n_ problems w_th, spec_f_c_lly. Otherw_se, you''re essent__lly _sk_n_ us to m_ke the pro_r_m for you.

  +------------+
  |            |
  |            |
  |            |
  |
  |
  |
  |
  |
  |
  |
  |
  |
  |
--+--------



如果您没有向我们展示您所遇到的具体问题,我们会盲目猜测,那绝对不会很有趣...好的,有时候很有趣,但是在编程论坛上不是.



If you don''t show us what specifically you are having a problem with, we are guessing blindly, and that''s never fun... ok, it''s fun sometimes, but not on a programming forum.


这可能有帮助 [
This may help[^]

Quick search gives you all you need to know.


这篇关于C#Hangman游戏帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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