本文介绍了如何在C中创建菜单以选择游戏难度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿我正在编写c中的扫雷游戏代码,我想制作一个菜单,以便用户可以选择30比30的游戏难度,其中99个炸弹16比16,30个炸弹和9个9有10枚炸弹。有人能告诉我怎么能实现这个目标?比如用户必须输入1表示简单2表示中等和......



我尝试过:



i知道我可以使用switch case,但代码太大了。无论如何在另一个项目的代码块中运行某个项目?因为那样可以完全解决我的问题。

Hey I’m writing the code for a minesweeper game in c and i want to make a menu so that the user can select the difficulty of the game like 30 by 30 with 99 bombs 16 by 16 with 30 bombs and 9 by 9 with 10 bombs. Can someone tell me how can i achieve this? like the user has to enter 1 for easy 2 for medium and... .

What I have tried:

i know i can use switch case but the code is too large. is there anyway to run a certain project in code blocks from an another project? because that would totally solve my problem.

推荐答案



引用:

我知道我可以使用switch case但是代码太大了。无论如何在另一个项目的代码块中运行某个项目?因为那样可以完全解决我的问题。

i know i can use switch case but the code is too large. is there anyway to run a certain project in code blocks from an another project? because that would totally solve my problem.



即使你的项目大100倍,它也不会太大。

每个难度级别之间的差异是雷区的大小和地雷数量,你不可能需要第二个项目。


Even if your project was 100 times larger, it wouldn't be too large.
The difference between each level of difficulty is the size of minefield and number of mines, there is no way you need a second project for this.


这篇关于如何在C中创建菜单以选择游戏难度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 14:52