This shows my ignorance. How would you do this?
Sorry for newbie question
Fred
Hey dude. I do numeric programming for a living, although I feel like
I'm just now getting the hang of it.
Stroustrup is a good *technical* reference, but it's pretty hard to
read, especially if you are new to programming. I personally have two
books that are almost always open on my desk: The C++ primer by S.
Lippman, and the Stroustrup book. The Stroustup book is great, but not
always decipherable when you are just starting out. This is especially
true when you really just want to figure out something new.
Depending on your time constraints, take a couple days to just read the
lippman and/or stroustrup books (or something else). Familiarize
yourself with classes and member functions. It's really handy and will
save you a lot of time in the long run.
Then sit down and break down your program: What do you need to have
running right away (for testing purposes). What do you want in an ideal
world where you have lots of time and programming expertise? What does
your simulation do? Input? Output?
Then: Are there any libraries out there you can use to simplify your
work (google,
www.boost.org,
www.oonumerics.org)? If so, use them.
Then sketch out your program a little. Make a kind of outline how you
want things to work. What classes will store what data, and what
function will they do? A class is like a structure, but also contains
functions. It's handy. Really.
As for efficiecy, that comes a bit with practice. Try not to worry too
much. Premature optimization is the root of all evil. On the other
hand we can't ignore efficiency. Try to avoid doing anything obviously
bad. When it's done, if it runs too slow, try to figure out why, and
how to improve it (profiling tools).
If you have a numeric programmer around, talk to them as your working.
Finally, I have a collection of simulations I've programmed in C++ on my
website
www.glenstark.org (go to Programs). you can look it over and
see if anything is helpful, but be warned: I'm a mediocre programmer,
and my early stuff is especially mediocre.
Glen