发新话题
打印

求助,谁能帮我写个C++程序可以在Unix里运行

求助,谁能帮我写个C++程序可以在Unix里运行


3
个孩子的情况均要显示, 要有一个隐藏选项c (cheat)来展示每个孩子所有情况值. 当任意一项达到100(0开始)孩子会哭.
但是如果再用c查看具体是哪一项达到100,之后再满足条件,就不会哭了(如:Bob饥饿值到100,此时再进行喂养,孩子便不哭了)


unix执行)包括5个文件:
1. daycare.cpp---包含主程序和一些函数
2. baby.cpp---包含执行baby class
3. baby.h---包含baby class的说明
4. Makefile
5. transcript.txt


Makefile必须建立两个步骤,一个是编译(compiling.o)另一个是连接到执行文件

只有一个class,Baby. class Baby中的每一个对象都要代表一个你所假设的baby.

开头例如:

Bob,6months old


Ann,12months old


Daisy,8months old


不能用:
任何数组(arrays)除了vectors, lists
不可以用全局变量和随机变量

更新运行时数据显示:
  饥饿程度(hunger)增加是孩子年龄的2
  换尿片(nappy)2*(12-孩子的年龄)
  无聊程度(boredom)每次增加20

每一步的演示都要存在transcript.txt


终端中,
Chnod
777 daycare

./daycare
则将显示如下:
Welcome to the Daycare Game.
By Gao Huiying ,Student ID:05970312

This is just a toy program
It is not supposed to actually reflect the behaviour of babies or their carers.

6 months old baby has arrived!
12months old baby has arrived!
8 months old baby has arrived!

Bob is content
Ann is content
如果哭则显示:Ann is***crying!***

Daisy is content

(F)eed a baby
(N)appy change a baby
(P)lay with a baby
(R)elax
(A)rrival of baby
(D)eparture of baby
(Q)uit

Your choice ?
(选择选项,如 N
Which baby ?
(再选择孩子)

TOP

发新话题