Hi Everyone I have am doing an object oriented C++ program 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 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
45 3957 AdrianH 1,251
Recognized Expert Top Contributor
Ok, looks like you have a general flow of your programme done. Now can you identify the objects you require?
Adrian
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.
ok so how do i go abt it, its too complicated for me to code it!!!!!
btw what makes my program object oriented then........... .... i havent written the game code still as i am poor at coding but i am just curious as to what would make the overview Object Oriented , i mean what changes???
AdrianH 1,251
Recognized Expert Top Contributor
ok so how do i go abt it, its too complicated for me to code it!!!!!
Relax. First you don't code, you design.
When you design, think about what objects you need, you look at the requirements and start picking out nouns (things). When you have your nouns, see if any are of a common group. I.e.
dog, cat, wolf, bear -- These are all types of animals
corola, versa, echo, matrix -- These are all types of cars
Then once you have your objects, start picking out the related verbs (actions) for a noun.
dog -- walks, eats, runs
cat -- walks, eats, runs
wolf -- walks, eats, runs
bear -- walks, eats, runs
thus all animals (at least in this set) walks, eats, runs so can be used as function names.
You can even have questions too for things that may be different between them: - .
-
can get has how
-
newspaper? many legs?
-
dog yes 4
-
cat no 4
-
wolf no 4
-
bear no 4
Given your description, can you state some objects, group them and make up some verbs/questions for them?
Adrian
Given your description, can you state some objects, group them and make up some verbs/questions for them?
Adrian
ok lets c
object- verbs
pigeon- fly, walk
wheelbarrow- roll
ball- roll, fall
stone- fall, roll
lizard -crawl, eat
wheels- roll, turn
cat- jump, walk, eat, swim
plane- fly, roll
time- crawl, fly
river- run
crocodile- crawl, swim, roll
fish- swim
each object has different functions some are common, this should give the output as required if designed for random printing of verbs as described in my very first post, what say???
AdrianH 1,251
Recognized Expert Top Contributor
ok lets c
object- verbs
pigeon- fly, walk
wheelbarrow- roll
ball- roll, fall
stone- fall, roll
lizard -crawl, eat
wheels- roll, turn
cat- jump, walk, eat, swim
plane- fly, roll
time- crawl, fly
river- run
crocodile- crawl, swim, roll
fish- swim
each object has different functions some are common, this should give the output as required if designed for random printing of verbs as described in my very first post, what say???
That's good. You will also need to have it able to display what it can do as well.
Sorry, but I need to go and will not be back for pretty much the rest of the day. If Weaknessforcat is around, s/he may be able to help you as s/he is a quite competent C++ programmer with OOP experience.
I’ll look in on your progress later. Good luck.
Adrian
ok thanks for everything till now, but i still have to finish it in 2 days before 25th May, so will look forward for help and fast
AdrianH 1,251
Recognized Expert Top Contributor
ok thanks for everything till now, but i still have to finish it in 2 days before 25th May, so will look forward for help and fast
Ok, you know the class syntax right? So generate a class for each object, inheiriting from a single class. Use the verbs you stated (and I suggested) as function calls.
Let me know if you have any troubles.
Adrian
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: vbian |
last post by:
Hi,
I'm looking for information about companies using dotnet for the next
generation of games. I've been impressed by the managed examples that
come with the dx9 sdk, they're a huge step up from those available with
the dx8 and below sdk's.
There also seem to be a number of books covering this subject, but then
I've still got a copy of "C++ real-time graphics" which probably didn't
inspire the original wolfenstein ;)
If you can...
|
by: noob23434 |
last post by:
Hi all
I've been told that the best platform to make games on (strategy games)
is a c++. I want to start making games using my mac and I was wondering
if anyone could tell me what software is the best to get started with?
Kind regards
Marc
|
by: jaso |
last post by:
Hi,
I'm making this video game in C.
The game contains a player, enemies and bullets. These objects,
which are arrays of structures, are initialized, updated and drawn
in a game loop. Now I am unsure on where to declare these things.
I could declare them in main() like this
#define NUM_ENEMIES 10
#define NUM_BULLETS 20
|
by: JJ |
last post by:
Having done most of the background sql coding I'm now ready to start
designing my asp.net web pages.
A basic question though - is there a way of having 'common' elements on
pages (e.g. a header)?
This used to be done using frames, but I undertand these are now not
advised.
Basically what I want is to have some text/code that is common to all pages,
but that I only need to update in one place?
|
by: YellowFin Announcements |
last post by:
Introduction
Usability and relevance have been identified as the major factors
preventing mass adoption of
Business Intelligence applications. What we have today are traditional
BI tools that don't work
nearly as well as they should, even for analysts and power users. The
reason they haven't
reached the masses is because most of the tools are so difficult to use
and reveal so little
| |
by: =?Utf-8?B?cGNnYW1lcg==?= |
last post by:
Is VB good for game development? Or is C# or some other language better?
I'm a beginner programmer and would like to get into game development. I
can't find any decent tutorials, so links would be very helpful.
Thanks
|
by: Advertiser for `2D Games Development Central` |
last post by:
New to game development? Need a headstart in creating that first game
of yours? Want to meet others who share a passion for playing and
creating games? Need support, but don't know where go for it? Are you
just passionate about games?
2D Game Development Central is a newly founded group on Google Groups
that is dedicated to the creation of games, especially with regards to
2D. We offer you the chance to join a community of newcomers just...
|
by: pereges |
last post by:
I want to begin by making simple 2D games for Dos. What particular
features of C should I look to strengthen ? I am not asking about the
graphics bit but in general.
|
by: Benjamin Vigneaux |
last post by:
Well, I'm very interested in game development, I'm just starting out though,
browsing here and there for tutorials, references, etc.. and learning about
the game development industry...
What i've realized is that, apparently, most of the games out there are
likely to be coded in C++, is this because the language offers features
which are better suited for game development? or just because it has been
out in market for a longer period of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |