By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,356 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,356 IT Pros & Developers. It's quick & easy.

stuck on a very simple c++ program

P: n/a
i am a very beginner programmer and am stuck on a very simple problem.
I am trying to make a game where the user
is presented with a scenerio and options. ie

you are standing in the parking lot
a.run
b.go home
c.stay there

when a option is selected a new option is presented.
How do i do this. Here is the code I have so far. I have been on it
for days and i have until saturday. please help. thanks.

#include <iostream>

using namespace std;

void MorningMain()
{
cout<<"You walk into the main building.\n
a. Go left to the computer room.\n
b. Go right to the office.\n
c. Continue ahead into the "concourse".\n
d. Go back out side.\n"
}

void MorningIE()
{
cout<<"You walk into the the I.E. building. A grade eight
student is being shoved
into a locker.\n
a. Help the grade 8\n
b. Go into the art room\n
c. Go into the Shop.\n
d. Go into the Wood Room.\n
e. Go into the washroom.\n
f. Go back out side.\n"
}

void MorningGym()
{
cout<<"You go into the gym and see that there is a pick-up
basketball game
going on.\n
a. Ask \if you can play\n
b. Watch\n
c. Go up to the weight room\n
d. Go back out side\n"
}

void MorningComp()
{
cout<<"You go into the computer room. There seems to be alot
to do here.\n
a. Go on a computer\n
b. Talk to Mr.Schulting\n
c. Take an Optical Mouse\n
d. Go back into the concourse\n"
}

void MorningConcourse()
{
cout<<"You walk into the "concourse", still not
understnading why they can't
just call it the cafeteria or something.\n
a. Sit with your friends\n
b. Go to the library\n
c. Go to computer room\n
d. Go to \class early\n
e. Go to the bathroom\n
f. Go back outside\n"
}

void HitGirl()
{
cout<<"You walk back outside and run into a girl and knock
all of her books
down.\n
a. Say sorry help her pick them up\n
b. Pretend nothing happened and \continue on\n"
}

void PlayBall()
{
cout<<"The other players put you on a team and let you play.
They pass you the ball
and you...\n
a. Shoot\n
b. Drive \for the hoop\n
c. Pass\n
d. Throw it up into the weightroom\n"
}

void WatchBall()
{
cout<<"You sit in the bleachers and watch the game. Soon the
bell goes and
you...\n
a. Go to \class\n
b. Skip \class\n"
}

void Weightroom()
{
cout<<"You walk up to the weightroom, throw a couple weights
on to a bar and
\try to bench them, and because you your great 'strength', you get
stuck
and can't lift the weights off of your self.\n
a. Yell \for help\n
b. Keep trying to get the weights off\n
c. Wait \for someone to show up\n"
}

void MorningFight()
{
cout<<"You come outside and see a bunch of people walking
towards the back of
the school. Looks like theres going to be a fight.\n
a. Go watch\n
b. Report the fight to the office\n
c. Mind your own bussiness and \continue on\n"
}

void IEFight()
{
cout<<"You tell the guys shoving the kid into the locker to
go get a life.
They think your an idiot, but they listen and they leave.
By the time you pull the poor kid out, the bell goes.\n
a. Go to \class\n
b. Skip \class\n"
}

void MorningArt()
{
cout<<"You go into the art room and see Mr.Mocci working the
the backroom.\n
a. Talk to him\n
b. Take some art supplies\n
c. Leave\n"
}

void MorningShop()
{
cout<<"You go into the 'Shop' and see that no one is in
there, but you see the
"Rattler Racing Car". You...\n
a. Go over to the car\n
b. Steal some tools\n
c. Leave\n"
}

void MorningWood()
{
cout<<"You walk into the 'Wood Room' and see a bunch of
students building a table.\n
a. Go over to the kids\n
b. Use some machines\n
c. Leave\n"
}

void IgnoreKid()
{
cout<<"You ignore the people shoving the kid into the locker
and come back outside. You...\n
a. Go to the main building\n
b. Go to the gym\n
c. Go back into the I.E. Building\n"
}

void GetPunched()
{
cout<<"You tell the guys pushing the kid around to stop, and
one of them punches you in
the face and starts pushing you around in the circle too. So much
\for, 'Safe Schools'.
Mr. Sutherland comes outside and breaks it up, but only after you get
a bloddy nose.\n
a. Go to the main building\n
b. Go to the gym\n
c. Go to the I.E. building\n
d. Go to a washroom and wash all the blood\n"
}

void IgnoreCircle()
{
cout<<"You see that they are pushing a kid around in a
circle and beating him. You decide that
there is no point in saying anything because you'll end up with that
poor kid.\n
a. Go to the main building\n
b. Go to the gym\n
c. Go to the I.E. building\n"
}

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
jessebasketball wrote:
i am a very beginner programmer and am stuck on a very simple problem.
I am trying to make a game where the user
is presented with a scenerio and options. ie

you are standing in the parking lot
a.run
b.go home
c.stay there


Look for the function getch(). And if you don't mind me saying, you
could consider removing all those function in favor of data array.
Your main display function would have a paramater which is a state of
the game based on which it would display text, and read output, and
return the new state. Your main() would just loop until specified
states are reached.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.