CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Raislin

Page 1 of 5 1 2 3 4

Search: Search took 0.04 seconds.

  1. Replies
    9
    Views
    1,681

    Re: Beginner Tic-Tac-Toe game

    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.
  2. Replies
    9
    Views
    1,681

    Re: Beginner Tic-Tac-Toe game

    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...
  3. Re: function overloading with char and string type

    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...
  4. Replies
    16
    Views
    1,158

    Re: My program runs but doesnt do....

    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...
  5. Re: Why can't my compiler generate a custom copy constructer for ostream?

    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...
  6. Replies
    4
    Views
    530

    Re: Very Basic Question

    It wasn't asked, but I figure it's worth pointing out that this is not C++, but C. Definitely an important distinction.
  7. Replies
    16
    Views
    1,158

    Re: My program runs but doesnt do....

    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...
  8. Thread: Project Help

    by Raislin
    Replies
    2
    Views
    466

    Re: Project Help

    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...
  9. Replies
    5
    Views
    862

    Re: C++ Listbox problem

    It's hard to say without being able to see any code. Would you be able to provide the pertinent information?
  10. Re: trying to find grade average of user input csv

    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...
  11. Replies
    2
    Views
    357

    Re: Program Trace Help

    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 &#37; 2? Is it 1? That'll determine the first output. What is a equal to for the switch statement? ...
  12. Re: Slight crashing problem with my Code.

    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).
  13. Replies
    28
    Views
    2,165

    Re: can't understand the problem.

    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...
  14. Replies
    28
    Views
    2,165

    Re: can't understand the problem.

    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...
  15. Replies
    17
    Views
    3,755

    Re: Reading a .dat file

    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.
  16. Replies
    1
    Views
    609

    Re: Declaring array in constructor

    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...
  17. Re: no virtual destructor, memory leak in this case?

    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. ...
  18. Replies
    6
    Views
    2,867

    Re: Prevent Instantiation

    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...
  19. Replies
    6
    Views
    2,867

    Re: Prevent Instantiation

    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...
  20. Replies
    6
    Views
    2,867

    Re: Prevent Instantiation

    I actually considered that and may do so. Thanks for the quick response. Is this typically how such a thing would be done?
  21. Replies
    9
    Views
    1,088

    Re: Array of Structs

    Pretty much, minus the Student at the beginning. Accessing no of the first member would be like this:



    array_of_student[0].no
  22. Replies
    6
    Views
    2,867

    Prevent Instantiation

    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...
  23. Thread: Data Structure

    by Raislin
    Replies
    10
    Views
    995

    Re: Data Structure

    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];
    ...
  24. Replies
    3
    Views
    654

    Re: Simple question on constructors

    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...
  25. Replies
    13
    Views
    1,402

    Re: displaying a triangle

    It's probably simpler to write y<=x than y<(x+1).
Results 1 to 25 of 113
Page 1 of 5 1 2 3 4





Click Here to Expand Forum to Full Width

Featured