Search:

Type: Posts; User: Litz

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    10
    Views
    7,535

    Ah, that's right, totally forgot about that. I'll...

    Ah, that's right, totally forgot about that. I'll just create a vector of pointers with all the objects on class A and then and another on class B pointing to same place. It will still do what I want...
  2. Replies
    10
    Views
    7,535

    My bad, I'll change it. EDIT: Or I would but...

    My bad, I'll change it.

    EDIT: Or I would but can't change topic name apparently? It was supposed to say vector of pointers to objects stored in a vector I guess.
  3. Replies
    10
    Views
    7,535

    The add function already does that though. It's...

    The add function already does that though. It's something like this:



    void B::add(object* x)
    {
    vec.push_back (x);
    }
  4. Replies
    10
    Views
    7,535

    Oh sorry, my bad, I didn't mean to write...

    Oh sorry, my bad, I didn't mean to write A::classes[some index].add (&something), but A::classes[some index].add (&A::vec[A::vec.size()-1]), so I would add the copy the vector created, and not the...
  5. Replies
    10
    Views
    7,535

    Vector of pointers to objects stored in a vector

    So I'm working on a program, and I wanted to do something like this:

    Class A has a vector<object>, where all the objects of that type are stored in. Each time a new object is created, I push it...
  6. Thread: Playing C++ games

    by Litz
    Replies
    4
    Views
    2,676

    You just compile the program, creating an...

    You just compile the program, creating an executable you can run, just like any c++ console application. Start reading a book and you'll understand it.
  7. Thread: Question for C++

    by Litz
    Replies
    11
    Views
    1,387

    Pay someone to do it or do it yourself. Also,...

    Pay someone to do it or do it yourself. Also, stop making stupid topics. If you need help with something you're coding, post away, but don't expect anyone to actually write you a full program. This...
  8. Replies
    3
    Views
    2,357

    You are erasing whatever the iterator "it" is...

    You are erasing whatever the iterator "it" is pointing at, making "it" a null pointer, and then you try to use it. At least that's what it seems, but it's kinda hard to read through all that. Please...
  9. Replies
    4
    Views
    2,507

    That C part kinda draws me back.. I don't really...

    That C part kinda draws me back.. I don't really know C (and I'm not really interested in learning it just for OpenGL). Is DirectX more C++ oriented? I could always just learn that instead of OpenGL...
  10. Replies
    9
    Views
    1,267

    See your while loop? You wrote this: while...

    See your while loop? You wrote this:

    while ((playerInPet != "cat") && (playerInPet != "dog") && (playerInPet != "eagle"));

    Notice how you added a ; in the end of it. Basically you're ending the...
  11. Replies
    9
    Views
    1,267

    You removed the transform statement. Basically if...

    You removed the transform statement. Basically if you enter "Dog" now, it will fail as you're not transforming the string to lower-case.
  12. Replies
    9
    Views
    1,267

    Why do you have this on your source code? ...

    Why do you have this on your source code?

    while(playerInPet != "cat" or "dog" or "eagle")

    Like it was said above, replace it by this and it will work:

    while( (playerInPet != "cat") &&...
  13. Replies
    4
    Views
    2,507

    Good learning path?

    So I'm really just a C++ console programmer, but recently I started wanting to learn about graphics and movement. As such, I thought it would be a good idea to do some game programming, to get a...
  14. The cast will round it down as it basically cuts...

    The cast will round it down as it basically cuts off the decimal part of the number.
    The code seems fine though.
  15. Replies
    10
    Views
    2,315

    I didn't check the file or anything, but since...

    I didn't check the file or anything, but since you have the code done, all you have to do is compile it to create the executable.
  16. Replies
    3
    Views
    907

    I didn't read the whole program but since you...

    I didn't read the whole program but since you said you're just having problems with the file, I assume that's the only problem. So, is the file being opened? Add a condition to check if the file is...
  17. Replies
    3
    Views
    907

    You need to actually open the file before reading...

    You need to actually open the file before reading it.

    First, define fin with "ifstream fin". Then, open the file. To do that, you use "fin.open ("payroll.txt"). When you're done reading all the...
  18. Replies
    33
    Views
    3,833

    Please don't bump old topics. Last post was in...

    Please don't bump old topics. Last post was in 2006.
  19. Didn't even remember when I was typing, my bad.

    Didn't even remember when I was typing, my bad.
  20. Basically, a class has two parts: public and...

    Basically, a class has two parts: public and private. Private members aren't meant to be accessed by anything else.

    For example, if your "speed" variable was public, you could change its value...
  21. Replies
    8
    Views
    2,439

    You are making some confusions in that code, and...

    You are making some confusions in that code, and doing things you don't really need to.

    You want to display the square of all numbers in a range, and calculate their average, so you only really...
  22. Thread: New to classes

    by Litz
    Replies
    6
    Views
    1,069

    I don't really understand what you're saying....

    I don't really understand what you're saying. That code compiles (and works) fine...
  23. Thread: New to classes

    by Litz
    Replies
    6
    Views
    1,069

    I don't really understand your question. Mind to...

    I don't really understand your question. Mind to show us an example where it doesn't work?
  24. Replies
    7
    Views
    1,291

    while (!infile) Isn't that just returning...

    while (!infile)


    Isn't that just returning false right away when you have input?
    Try to remove the negation and try again.

    Also, I haven't really looked at the rest of the code.. If you're...
  25. Thread: arrays

    by Litz
    Replies
    3
    Views
    1,645

    You could add a condition to check if...

    You could add a condition to check if scores[counter] is -1, after reading the first number.

    There's also lots of other things you could improve. Function int main () should always return 0; your...
Results 1 to 25 of 42
Page 1 of 2 1 2