2 qq 33701809 qq_33701809 于 2016.01.31 10:29 提问

请帮看一下一道C++的题目。还可另得100C(总计200C) 100C

问题如下:

我们要创造一个游戏,这游戏是为了测量玩家在规定时间内能记得多少信息,以下是解析这游戏是如何玩的:
第一步:有两位玩家;
第二步:每个玩家开始都有十分;
第三步:游戏需要提示第一位玩家输入一段话。第二位玩家不允许看。

第四步:程序向第二位玩家展示第一位玩家输入的一段话,然后通过不断换行清除屏幕中的一段话。询问玩家是否准备好答题,如果还不行,就继续展示在屏幕上,这一次留在屏幕的时间会延长。每一次玩家需要再看一遍,玩家的分数就会从自己的总分里扣除。当分数变为零之后,这时候就交换角色。

第五步:一旦玩家准备好开始答题,第二位玩家则凭记忆输入那段话
第六步:你的程序得算出在玩家输入的问题和原始问题的字数,并且每个字母都得一样,这样玩家就会得到一分,但是不能超过原始的总分10分。

第七步:接着就交换角色

第八步:这个步骤一直持续到谁没有分数为止(那他就输掉)

要求程序需要用cstring中的strlen来确定问题的长度
需要用数组,数组下标。

小孩的解答如下,请斧正:
Algorithm for the programming assignment #2
Algorithm for the game of absorb material
Step1: Welcome the user and explain the purpose of how to use this program to play
Step1a: Display a heading (“absorbing material game”)
Step2: Get the name of players
---(step2a)Prompt the user

“Please input the name of the first player”

---Enter the name of first player (player[0])

---Read it in the data and store in a char variable

---Echo the name of the first player (display it)

“The first player’s name” amount the variable

---Ask the user if the name was correct (Y/N)

---If not, re-prompt and read until the user player is happy (repeat step 2a)

---(step 2b)Prompt the user again

“Please input the name of the second player”

---Enter the name of second player (player[1])

---Read it in the data and store in a char variable

---Echo the name of the second player (display it)

“The second player’s name”amount the variable

---Ask the user if the name was correct(Y/N)

---If not, re-prompt and read until the user player is happy (repeat step 2b)
Step3: Distribute the points
---(step 3a)Prompt the first user

“Please input the points of the game! (10 points)”

---Enter the number of the points ( int a)

---Read it in the data and store it in a int variable

---Echo the number of the points (display it)

“The number of the points at the before beginning the game”amount the variable

---Ask the user if the points meet with the requirement of the game(Y/N)

---If not, re-prompt and read until meet with the requirement (repeat step 3a)

---(step 3b)Prompt the second user

“Please input the points of the game! (10 points)”

---Enter the number of the points (int b)

---Read it in the data and store it in a int variable

---Echo the number of the points (display it)

“The number of the points at the before beginning the game”amount the variable

---Ask the user if the points meet with the requirement of the game(Y/N)

---If not, re-prompt and read until meet with the requirement (repeat step 3b)
Step4: Enter the question
---(step 4a)Prompt the first player

“Please input the question on the screen”

---Enter the question (char question[])

---Count the number of words of the question and store it in a int variable (int c)

---Read it in the data and store it in a char variable

---Echo the question (display it)

“The question is” among the variable

---Ask the first player if the question is correct(Y/N)

---If not, re-prompt and read until the user is happy (repeat step 4a)
Step5: Clear the question
---Prompt the second player

“Don’t see the problem when the first player enter the question”

---Display the question and disappear quickly( type the enter key)
Step6: Show the question for the second player
---Prompt the second player

“Are you ready to see the question and you have only three seconds to see (Y/N)”

---Enter the answer (char ch1)

---If the answer is Y (y)

---Read it in the data and store it in a char variable

---Echo the answer (display it)

“Your answer is”among the variable

---If yes, then do the next step

---Echo the time left (display it)

“Time-left:”among the positive number

Step7: Memory the question
---Prompt the second player

“You have five seconds to recall the question”

---Echo the time left (display it)

“Time-left:”among the positive number

Step8: Try to relax
---Prompt the second player

“Relax yourself before answering the question”

Step9: Is ready for the second player
---(step 9a)Prompt the second player

“Are you ready to answer the question? (Y/N)”

---Enter the answer (char ch2)

---Read it in the data and store it in a char variable

---Echo the answer (display it)
“Your answer is”among the variable

---Ask the second player if the answer is correct(Y/N)

---If not, re-prompt and read until the meet with the second player’s requirement

(repeat step 9a)

---If the second player answer is no

---Read it in the data and store it in a char variable

---(step 9b)Prompt the second player

“This time you have 30 seconds to see this question and remember it, but your

 Points will deducted” (points=points-1)

---Read the points in the data and store it in a integer variable

---Show the question on the screen

---Echo the time left (display it)

“Time-left:”among the positive number

---Prompt the second player

“You have ten seconds to recall the answer”

---Echo the time left (display it)

“Time-left:” among the positive number

---Prompt the second player

“Relax yourself before typing the question”

Step10: Begin to type the question
---Prompt the second player

“Begin to type the question”

---Enter the question (char question1[])

---Count the number of words of the question1 and store it in a int variable (int d)

---Read it in the data and store it in a char variable
Step11: Compare the number of words
---(step 11a)If the number of words in the same and the word(Y/N)

---If yes, then do the next step

---Echo a sentence (display it)

“You do a great job! And you can add one point to your points” (points=points+1)”

---Read it in the data and store it

---If no, then do the next step

---Echo a sentence (display it)

“Your point need to deducted by one point” (points=points-1)

---Read it in the data and store it
Step12: Switch turns
---Prompt the player

“The position of the player changes”

---Repeat the step from step 4 to step12 until one player has no point
Step13: Game over
---Prompt the player

“Who don’t have points?”

---If the first player don’t have points

---Echo a sentence (display it)

“The second player win the game”

---If the second player don’t have points

---Echo a sentence (display it)

“The first player win the game”

Step14: Re-play the game
---Prompt the player

“Do you want to play again? (Y/N)”

---If yes, then repeat the step from step2 to step13

---If no, then exit the game
Step15: Thank you for using this program to play

6个回答

a1193561652
a1193561652   Rxr 2016.01.31 13:31

是要控制台程序还是windows窗口程序?如果是两个玩家那需要两个客户端吧,中间用网络通讯?

a1193561652
a1193561652 那你还是找别人吧,今天手边没电脑,没法给你做,最早只能明天中午做给你。 还有如果是作业,百度上通常都有的,你找找看。
2 年多之前 回复
qq_33701809
qq_33701809 回复纵横车: 玩家二转过脸去就行了。只是作业,并不用于实际。最好是今天能出来。十分感谢
2 年多之前 回复
a1193561652
a1193561652 如果只单机实现那玩家一在输入的时候玩家二不都看着在?另你这个什么时候要?
2 年多之前 回复
qq_33701809
qq_33701809 WINDOWS窗口程序就可以了。在单机实现即可,一个作业来的。尽量从简。
2 年多之前 回复
devmiao
devmiao   Ds   Rxr 2016.01.31 14:59
a1193561652
a1193561652   Rxr 2016.02.01 13:37

http://download.csdn.net/detail/a1193561652/9424503

图片说明

图片说明

图片说明

做好了,不知道你还要不要,界面大致是这样的,是VS2010的工程。

qq_33701809
qq_33701809 十分感谢,能否以文本形式发给我。
2 年多之前 回复
qq_33701809
qq_33701809   2016.01.31 10:31

另得100C链接http://ask.csdn.net/questions/235147。
属于同一个问题。我将一同给分。还请大神不吝赐教

yao_jing
yao_jing   2016.02.02 09:42

看样子已经处理了 ? 我也就是来看看到底什么问题,好像很麻烦的样子

henuyx
henuyx   2016.02.18 17:31

建议用控制台显示输出来做

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
一道找规律的题
题目描述 给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值,其中k mod i表示k除以i的余数。 例如j(5, 3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3 mod 5=0+1+0+3+3=7 输入 第一行2个数n,k。 输出
10年第六届湖南省acm程序设计大赛 第二题 B 弟弟的作业
题目B弟弟的作业你的弟弟刚做完了“100以内数的加减法”这部分的作业,请你帮他检查一下。每道题目(包括弟弟的答案)的格式为a+b=c或者a-b=c,其中a和b是作业中给出的,均为不超过100的非负整数;c是弟弟算出的答案,可能是不超过200的非负整数,也可能是单个字符"?",表示他不会算。 输入输入文件包含不超过100行,以文件结束符结尾。每行包含一道题目,格式保证符合上述规定,且不包含任何空白字符。输入的所有整数均不含前导0。 输出输出仅一行,包含一个非负整数,即弟弟答对的题目数量。样例输入样例输出1+2
NYOJ 663 弟弟的作业【简单题更能体现水平。。。】
弟弟的作业 时间限制:1000 ms  |  内存限制:65535 KB 难度:1 描述 你的弟弟刚做完了“100以内数的加减法”这部分的作业,请你帮他检查一下。每道题目(包括弟弟的答案)的格式为a+b=c或者a-b=c,其中a和b是作业中给出的,均为不超过100的非负整数;c是弟弟算出的答案,可能是不超过200的非负整数,也可能是单个字符"?",表示他不会算。 输入输入文件包含不超
马克思手稿中的趣味数学题。
#include <stdio.h> #include <stdlib.h>int main() { int i,j,k; printf("Input Man Woman Children:"); for(i=0;i<=30;i++) for(j=0;j<=30-i;j++) { k=30-i-j; if(3*i+2*j+k==
打印·剥洋葱
2016年吉首大学信息学院程序设计新生赛 pta
[C/C++]各种面试题
各种面试题   *程序的内存分配一个由c/C++编译的程序占用的内存分为以下几个部分1、栈区(stack)—   由编译器自动分配释放 ,存放函数的参数
103 一道题目玩转指针数组和二级指针
C学习网:链接->C学习网 C训练网:链接->C训练网 请大家先看下面的代码: #include int main(){ char *lines[5] = { "COSC1283/1284", "Programming", "Techniques", "is", "great fun" };
【bzoj1251】序列终结者 Splay
Description网上有许多题,就是给定一个序列,要你支持几种操作:A、B、C、D。一看另一道题,又是一个序列 要支持几种操作:D、C、B、A。尤其是我们这里的某人,出模拟试题,居然还出了一道这样的,真是没技术含量……这样 我也出一道题,我出这一道的目的是为了让大家以后做这种题目有一个“库”可以依靠,没有什么其他的意思。这道题目 就叫序列终结者吧。 【问题描述】 给定一个长度为N的序列,每个序列
剥洋葱
布告,布告! 应老师要求,我们要做一道打印图形的题目,这是程序员最基本的能力。 那废话不多说,我们来说要求的图形 AAAAA ABBBA ABCBA ABBBA AAAAA 就是外到内,从A到Z。每一层都是一种字母,最里面的一层为一个,即最中心的一个。 输入格式: 一行,一个整数,即图形的层数 输出格式: 如上述图形 输入样例: 3 输出样例: AAAAA
一道关于比特币的考题
今天坐地铁一路看上一篇转的《我们正处在区块链行业历史的前三分钟,这个时代意味着什么》,受到不少启发,也引发了一些思考。 一道考题 刚刚过去的这个周六,在职研的“经济统计研究”随堂考试,正好有一道题跟数字货币有关。先说说这门课,两天的时间(其实是一天半)老师讲了几个大主题,包括GDP、失业、国际收支平衡表、财政收入和支出等。第一节课是边看《linux口袋书》边听,第二节课觉得虽然不太感兴趣,但是...