Search:
Type: Posts; User: Raislin
Search:
Search took 0.04 seconds.
-
March 9th, 2010, 04:25 PM
Ha, you can imagine how silly I feel for missing the 'do.' *thumps head on desk* Funny that a semi-colon terminated while loop ended up being the problem, after all.
-
March 7th, 2010, 07:18 AM
Ah. That's extremely helpful. I honestly just didn't read the code before. Here's the culprit in the askNumber function:
while (number > high || number < low);
It should be pretty...
-
March 4th, 2010, 06:06 AM
Correct, because implicitly converting from a const char * to std::string is allowed. Although your other function is passes as char *, rather than const char *, it seems it is not counted as an...
-
March 2nd, 2010, 02:15 PM
Mmm. That's true. I briefly learned how to use char arrays first (and why you shouldn't), but I was aware from the outset that it's essentially incorrect in C++ and std::string is the right way. I...
-
March 2nd, 2010, 02:10 PM
Why would you need a copy constructor for an ostream? And the problem probably isn't because of the stream, but how you're using it. Can you show some code for clarification?
Edit: The below...
-
March 1st, 2010, 04:03 PM
It wasn't asked, but I figure it's worth pointing out that this is not C++, but C. Definitely an important distinction.
-
March 1st, 2010, 04:01 PM
Not that I disagree in any way, but is learning how to properly handle memory a bad thing? Or is just that you believe one should learn how to use the STL correctly before learning any underlying...
-
February 26th, 2010, 07:57 PM
As D_Drmmr said, you'd probably want to check for the end of the game after the players turn and the CPU's turn. You could make another small function that's called within updateAI() and...
-
February 26th, 2010, 07:50 PM
It's hard to say without being able to see any code. Would you be able to provide the pertinent information?
-
February 26th, 2010, 07:45 PM
Surround you code in [.code][./code] tags (minus the periods) to preserve indenting and make it easier to read.
First off, you're reading into a float variable with cin. The moment it hits a...
-
February 26th, 2010, 12:45 AM
If you take it a step at a time, you should be able to do it. You have a=3 and b=5. So what's b % 2? Is it 1? That'll determine the first output. What is a equal to for the switch statement? ...
-
February 23rd, 2010, 08:06 PM
Forums typically use BBCODE style tags which are surrounded by square brackets [], not pointed ones <>.
So <code></code> should be [ code][ /code] (without the spaces).
-
February 22nd, 2010, 11:55 AM
The suggested example:
asteroid_1.compare_energy_level(asteroid_1, asteroid_2); //Exactly as you guessed
will work, but it seems redundant to call with an object and also pass that object as a...
-
February 22nd, 2010, 11:42 AM
You're using compare_energy_level() and check_collision() as if they're static member functions. The way you defined them, you have to call them using an instance of the Energy class like you did...
-
February 22nd, 2010, 11:20 AM
You need to know how it's formatted. Without the source code that exports the information, there aren't many ways you can do it.
-
February 14th, 2010, 06:12 PM
As far as I know, you can only use a list of values to initialize an array when it's created, not when doing an assignment, which is what you're doing. So, in this case, using an empty bracket...
-
February 10th, 2010, 09:30 PM
If you don't have memory being allocated dynamically, then you won't have a memory leak. There's still no reason not to make a destructor virtual if you think a derivation of the class could occur. ...
-
February 6th, 2010, 08:57 PM
I think, perhaps, I'm overthinking this. In the source code I've been sifting through, it has a series of inheritance. What seems to happen is the implemented subclasses are used internally, but...
-
February 6th, 2010, 01:58 PM
I got this piece of information on another forum, regarding the piece of software that inspired my curiosity. In the following, IWhatever is an abstract class (pure virtual functions) and CWhatever...
-
February 6th, 2010, 01:13 AM
I actually considered that and may do so. Thanks for the quick response. Is this typically how such a thing would be done?
-
February 6th, 2010, 01:12 AM
Pretty much, minus the Student at the beginning. Accessing no of the first member would be like this:
array_of_student[0].no
-
February 6th, 2010, 01:05 AM
Hello. It's been awhile since I last came here, but I'm about to dive into a big personal project and have already have a question.
I have two classes, ClassA and ClassB. ClassA has ClassB as a...
-
June 22nd, 2009, 02:09 AM
It seems to me that what you're misunderstanding is how scope works. In the code
void add1( char nm[], int ag)
{ stud *st = new stud[1];
stud *ptr = &st[0];
...
-
June 21st, 2009, 07:26 PM
The line
cout << namescore[i] << endl;
is attempting to use the operator<<() method to output a Name_value object. The problem is that you don't have this operator overloaded for...
-
June 21st, 2009, 05:46 PM
It's probably simpler to write y<=x than y<(x+1).
|
Click Here to Expand Forum to Full Width
|