- #1
nemisis
- 6
- 0
Hi Everyone I have a object oriented C++ assignment which is due this week and I have no idea as to how start it....
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!
I am not good at all in 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 that's good
Thanks in advance
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!
I am not good at all in 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 that's good
Thanks in advance