Send to a Friend

Mariah's avatar

Is there a smarter way to program this (C++)?

Asked by Mariah (25883points) June 15th, 2012

I’m attempting to teach myself some C++ this summer, and an exercise I came up with is to program a virtual fishtank, trying to make it as realistic as possible. I’m going to try and include some water chemistry properties and the ways in which they interact (e.g. harder water has a more stable pH). And of course, there will be fish.

I’m pretty new to C++ so I don’t know a whole lot about when it is appropriate to represent something as a structure vs. an object, etc. But I’m thinking of making fish a structure. They’ll have a lot of properties, such as the range of temperatures they can withstand.

Right now the best way I can think to represent a range of temperatures is to give each fish an integer parameter “minTemp” and “maxTemp.” Or is there a data type that could do this for me?

Any other pointers?

Oh also, I’m probably gonna want to pick up a book on C++, because the internet tutorials aren’t quite doing it for me….any recommendations?

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.