C ++文本游戏中的设计和开发帮助 [英] Design and development help in C++ text game

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

问题描述

大家好我正在做一个面向对象的C ++程序,我不知道如何启动它.................


Hi Everyone I have am doing an object oriented C++ program and I have no idea as to how start it.................



此程序打印动作动词(飞行,跑步,游泳,爬行,行走或滚动),等待一秒钟,然后等待
然后打印实体的名称并重复动词(例如:fly ..1s ..鸽子飞!)。

玩家有?第二个输入?y?是的还是??不。 (不区分大小写)

- 如果答案是正确的,那么玩家得分,如果不正确,或者内部没有答案?第二,

玩家失去了一分。如果正确,可以打印实体可以执行的所有动作。


- 错误的时候,Ka..BOOM!相反打印。


每个玩家的默认问题数是20,但是可以通过在命令行上传递不同的

数来更改数字。启动程序。


在运行结束时,打印出玩家的得分(以及之前玩家的得分,如果有的话),

问题:?另一位玩家(是/否):?被问到。游戏退出如果?n?键入。


输出应该如下所示: -


播放器1开始。

你必须回答这封信吗?是的,还是?? NO。

准备开始时按[Enter]:


1?飞鸽飞啊!..

- 我走路了 - 我飞了

2?游泳独轮车游泳.. n $ / $
- 我滚动

3?爬球爬行!

Ka ... BOOM!

4?飞机飞啊!..

- 我滚 - 我飞。

5?跑船跑!.. n

- 我滚。

6?步行引擎步行!..

Ka..BOOM!

7?滚石滚动!..

- 我滚动。

。 。 。

16-爬行时间爬行!y

- 我爬 - 我飞。

17-游鹅游泳!.. n

Ka..BOOM!

18-跑蜥蜴跑!..

- 我跑 - 我爬行。

19-跑鼻子.. y

- 我跑了

20-飞鹅飞!..

- 苍蝇 - 我步行 ?我跑?我游泳。


玩家1 ***得分:16 ***


干得好!启动另一个玩家(Y或N)? y


玩家2开始

你必须回信吗?是吗?是的,还是?? NO。

准备开始时按[Enter]:


1?爬行长颈鹿爬行!..

Ka..BOOM!
This program prints a motion verb ( fly, run, swim, crawl, walk, or roll ), waits for a second,
then prints the name of an entity and repeats the verb (for example: fly ..1s.. pigeon fly!.. ).
The player has ? second to type ?y? for yes or ?n? for no. (case insensitive)
- If the answer is correct, the player scores, if incorrect, or if there was no answer within the ? second, the
player looses a point. When correct, all the motions the entity can perform are printed.

- When wrong, Ka..BOOM! is printed instead.

The default number of questions per player is 20, but the number can be changed by passing a different
number on the command line when starting the program.


At the end of the run the player?s score (and the score of previous players if there were any) is printed, the
question: ?Another player (Y/N): ? is asked. The game exits if ?n? is typed.

The output should look something like this:-

Player 1 starting.
You must answer with the letter ?y? for YES, or ?n? for NO.
Press [Enter] when ready to start:

1 ? fly pigeon fly!.. y
- I walk - I fly
2 ? swim Wheelbarrow swim.. n
- I roll
3 ? crawl ball crawl!..
Ka...BOOM!
4 ? fly plane fly!.. y
- I roll - I fly.
5 ? run boat run!.. n
- I roll.
6 ? walk engine walk!..
Ka..BOOM!
7 ? roll stone roll!.. y
- I roll.
. . .
16- crawl time crawl!.. y
- I crawl - I fly.
17- swim goose swim!.. n
Ka..BOOM!
18- run lizard run!.. y
- I run - I crawl.
19- run nose run.. y
- I run
20- fly goose fly!.. y
- fly - I walk ? I run ? I swim.

Player 1 *** score: 16 ***

Well done! Start another player (Y or N)? y

Player 2 starting
You must answer with the letter ?y? for YES, or ?n? for NO.
Press [Enter] when ready to start:

1 ? crawl giraffe crawl!.. y
Ka..BOOM!




我不擅长编码所以我试过并概述了主要驱动程序应该是什么样的



main {

start_function(a,b)

{

此处请查看玩家是旧的还是新的------>连接器


其中a =值是或否,由cin>取得>

如果vaue是的....

}

你回到主要>>>这里


现在开始for ... while / Do ... while [(条件为1/2分钟)&这个shld照顾最初的30秒也]

{

调用function2(循环为20个问题)

否则如果正确答案添加一个点

还调用一个函数来打印对象的作用(对于球,它将是我ROLL)


继续添加(+或 - )点变量


结束循环问题

}


显示最终分数

要求重播------------>连接器

}


但如上所述我有不知道整个程序的编码部分,并希望在这里有一些帮助请


除此之外,任何人都可以建议一个好的编译器,我使用Visual Basic C ++,如果这很好




I am not that good at coding so i tried and made an overview of what the main driver should look like


main{
start_function(a,b)
{
check here wherther the player is old or new------>Connector

where a = value of yes or no, taken by cin>>
if the vaue is yes....
}
you are back in main >>>here

now start the for...while/Do...while[(condition for 1/2 min)& this shld take care of the initial 30 seconds also]
{
call function2(loop for 20 questions)
else if right answer add a point
Also call a function to print what the object does (for ball, it will be I ROLL)

keep adding ( + or -)points in a variable

End for loop of questions
}

display final score
ask to replay ------------>connector
}


But as said above I have no idea on the coding part of the whole program and would like some help here please

Also apart from this can anyone suggest a good compiler, I use Visual Basic C++ if thats good

推荐答案

好的,看起来你已完成程序的一般流程。现在你可以确定你需要的物品吗?


Adrian
Ok, looks like you have a general flow of your programme done. Now can you identify the objects you require?


Adrian


注意AdrianH所说的话。您的大纲不是面向对象的。它是基于对象的。为了使它成为面向对象,你将a)需要识别你的实体,b)识别他们的abilites,c)构建一个类层次结构,d)使用虚函数。


Object基于编程是完全可以的,但不应该被称为面向对象,因为它有一个类或一个结构。
Pay attention to what AdrianH says. Your outline is not object-oriented. It is object-based. For it to be object-oriented, you will a) need to identify your entities, b) identify their abilites, c) construct a class hierarchy, d) use virtual functions.

Object-based programming is perfectly OK but should not be called object-oriented just becuse it has a class or a struct in it.


好的,我怎么去abt它,它太复杂了我要编码!!!!!
ok so how do i go abt it, its too complicated for me to code it!!!!!


这篇关于C ++文本游戏中的设计和开发帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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