Yeah... that's gonna work. Not sure why I didn't think of it myself, but that definitely works.
Thanks!
Type: Posts; User: Shaun32887
Yeah... that's gonna work. Not sure why I didn't think of it myself, but that definitely works.
Thanks!
I know that, that's why I came here to ask the question.
I should also add that the point of the program wasn't to display those statements. Like I said, it was only a toy program, the concept...
Yeah, you're right. I was thinking of another less efficient way to write the if statements.
Still, I would have the same problem.
#include <iostream>
Well, while it would have to fall through exactly 1 case, I'd have to set up some kind of flag and then if then break thing. That actually could work, I'll look into this.
Sorry, I didn't...
I didn't mean I was trying to get around the way the language was defined. I was simply asking the more experienced programmers if there was a quick way that would produce the same results. The...
Duplicate post, see bottom reply.
There's no way around that?
I chose switches because for what I'm doing, the if statements will be MUCH slower... and there's a lot of data.
This code won't work, I'm assuming it's because the case can't be a logical statement.
The actual program I'm working on would use a much more complex switch than this, this is simply a small...
I think what you want is
if((r == "rock") || (r == "1"))
Something along those lines. The || is the OR operator.
And yeah, loops and switches can be a little complicated at first if...
I think I'm not building the list correctly, which is frustrating since I'm using the same functions I use elsewhere, and they work there.
I think this was what was causing the program to crash, those should have been initialized to NULL. My mistake.
I fixed it, and while the program doesn't crash anymore, it's not outputting to...
So, I have two classes defined, gramNode and molecule.
I have linked lists created, the nodes of which are of the class gramNode. The class molecule has some data, and it includes a pointer to a...
Yeah, some hospitals can be pretty bad.
I work at Methodist down here in Houston, and I'm very happy to say that none of that happens here. It's to the point that even if someone is dying and...
I'll do that, but how do they compare with similar utilities provided by Boost? I have boost already, would this be a better way to go?
So what's the standard way of handling this situation?
I ask because the situation comes up a lot in my field and I've always been meaning to figure this out. When we're running samples on the...
:) Yeah, that sounds like it might be a problem.
Thanks laserlight, I'll go fix that.
Fix:
#include <string>
#include <iostream>
You're always helpful Daved, thanks.
I'll read up on those topics and let everyone know what I eventually come up with.
On a side note, I forgot to post the follow-up to my last thread. I just...
Almost forgot to do the follow up.
Thanks to everyone who helped me with this, here's the code I eventually settled with.
#include <string>
#include <iostream>
using namespace std;
Thanks, I'll read through these.
I looked at them before, but I don't think I knew what a vector was last week, and I'm still not too sure about containers, so it was understandably over my head....
Thanks for the quick reply.
I'll read through that thread. This is promising though, vectors definitely feel more comfortable, especially due to the large uncertainty in the final number of...
Then let it be known that I trust everyone, that's why I'm asking. However, I don't think anyone here will argue that there are many ways to approach any given problem. The methods given in one...
Daved,
Thats for the tips, that's basically exactly what I was looking for.
I remember, when I read about vectors I got somewhat excited because the resemble the arrays of Matlab a little bit...
Seriously?
There's smart people here, there's smart people there. That board has helped me just as much as this one, why is it so insulting???
Also, I don't think that TWO boards really...
My boss has recommended a hash table, but I'd like some second opinions as to what you think the best way to accomplish this task is.
My problem is that I don't know C++, so I've been learning...
I'm learning C++ right now for a job. I think I'm progressing pretty quickly, I have about a month of experience right now.
My method involves getting a textbook and reading chapters start to...