Search:

Type: Posts; User: Darkroman

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    8,325

    Couple of things that might help steer you in the...

    Couple of things that might help steer you in the right direction.
    1. There are only 24 hours in a day
    2. Look up the ASCII table.
  2. Replies
    1
    Views
    959

    changing arr[0] to arr[1]

    Here's what I mean


    void dectobin (int * arr, unsigned char b)
    {
    arr[0] = (b & 128) ? 1 : 0;
    if (b) dectobin (&arr[1], b << 1);
    }

    &arr[1] is what I'm mostly concerned about. I...
  3. I've done it, and more. I added the option of...

    I've done it, and more. I added the option of deleting it from either the head of the list, or the tail (depending on user choice). It may be a little ugly, but suffice to say, it works. Players get...
  4. I've figured it out through painstakingly going...

    I've figured it out through painstakingly going through how the program itself works in the memory (keeping track of it in my mind I should add...). The biggest thing I had trouble with were the...
  5. I've not attempted, because, honestly, I don't...

    I've not attempted, because, honestly, I don't know where to begin. FYI, it's not homework, I'm self-teaching. If I could know how to actually implement it in this specific program, it would be very...
  6. Adding a pointer to the end of a linked list

    So I've been getting back into programming, making sure I get everything covered, but there's one problem that I have NEVER been able to figure out. I've been reading 'Beginning c++ through game...
  7. Replies
    10
    Views
    1,028

    A class is like the main category of something...

    A class is like the main category of something (polygon). An instance is an object from the main category (from polygon you can make an instance of it for square, rectangle, hexagon, etc). That's the...
  8. Replies
    10
    Views
    1,028

    OK, awesome! So should I just call new instances...

    OK, awesome! So should I just call new instances of the class with the constructor giving different values to stats on program loading time instead?
  9. Replies
    10
    Views
    1,028

    yes, 100 enemies each with a unique value. So...

    yes, 100 enemies each with a unique value. So would it be more efficient if I made them read from a data file? And is there any other method for this?

    Edit: For clarity, let's say each enemy will...
  10. Replies
    10
    Views
    1,028

    inheritance question

    Say you have a base enemy class, but you want to have 100 different enemies... is there an efficient method to create 100 enemies (say from a base class), and provide them all with some unique value...
  11. Replies
    6
    Views
    1,196

    Not sure what any of that means. I guess I really...

    Not sure what any of that means. I guess I really shouldn't worry too much about it for now until I'm actually at that level of programming :) or find myself needing it.
  12. Replies
    16
    Views
    2,300

    The function prototype, and the function call...

    The function prototype, and the function call within main() (or any other function) all must have the same number of arguments (the variables) and the same data types (int, string, float, bool, char...
  13. Replies
    6
    Views
    1,196

    'new' member variables of a 'new' class?

    What are the advantages and disadvantages of having your members assigned with new?

    m_member = new int(10);
    // or
    m_member = new int(*(Foo.m_member));

    I have done this before, but...
  14. Replies
    5
    Views
    1,198

    Thanks for the quick reply, guys. My next...

    Thanks for the quick reply, guys. My next question is, do you have any references to a good tutorial on smart pointers? I've yet to learn these, and I must know the ins and outs :).
  15. Replies
    5
    Views
    1,198

    vectors of 'new' classes

    OK suppose I had a code like this


    vector<base *> vec;

    vec.push_back(new derived());

    delete vec[0];

    Code like this does compile, but I don't think I'm grasping this correctly. Basically...
  16. Cool, good to know. I do have another question...

    Cool, good to know. I do have another question for the ReleaseCritter function. I haven't seen the use of a pointer and reference used together. I notice it compiles without & and when i run it, it...
  17. Awesome! Thank you so much! I did notice the...

    Awesome! Thank you so much! I did notice the delete critter to case 0, that's to free the memory, and setting the pointer to 0 makes it null (I am at least familiar with that). I made an additional...
  18. Any chance you could show me through some example...

    Any chance you could show me through some example code? It'd be greatly appreciated :). I'm still new with c++ and even more recently, classes. I know somewhat about using pointers and/or references...
  19. Here's some code to give you an idea. ...

    Here's some code to give you an idea.


    #include <iostream>

    using namespace std;

    class Critter
    {
  20. Create a new class object through a function

    I want to know if it's possible.

    Basically, I want to give the user a choice of making a new object that's part of a class. The user enters the choice and it should call a function...
  21. Yeah, it's true I don't know much about...

    Yeah, it's true I don't know much about constructors, or instances all that much yet. I just got done doing chapter 4 in accelerated c++. It introduced structures but didn't explain it all very well....
  22. Thank you, guys! I got my program to work from...

    Thank you, guys! I got my program to work from following your suggestions + my own trial and error. I have one last question, and it pertains to correct use or not. So, I made an extra object for my...
  23. OK, so I changed apple& to fruit&, and I got...

    OK, so I changed apple& to fruit&, and I got multiple definition errors having to do with apple, banana, or melon. After that I just got rid of the objects all together. Now it's giving me a...
  24. struct with multiple objects in header file issues

    Problem: I can't get this seemingly simple program to compile. I've tried searching for hours. It's a struct in a .h file along with a function prototype and its src file that uses the function to...
  25. Replies
    4
    Views
    2,309

    Thanks, I had my logic mixed up with AND and OR...

    Thanks, I had my logic mixed up with AND and OR there with the while loops. Gotta remember AND comes to false if none or only one of the inputs are true, and OR comes to false if neither inputs are...
Results 1 to 25 of 37
Page 1 of 2 1 2