Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.14 seconds.

  1. Replies
    3
    Views
    54

    Let's ignore the operator chaining and just...

    Let's ignore the operator chaining and just consider:

    cout << paul;
    This is equivalent to:

    operator<<(cout, paul);
    Now you can see the arguments.
  2. Thread: Pointers

    by laserlight
    Replies
    6
    Views
    67

    Yes, so the last element has a pointer that just...

    Yes, so the last element has a pointer that just points to garbage, not to another element that points to another element etc. There's an end because at some point you have a pointer that is either a...
  3. Thread: Pointers

    by laserlight
    Replies
    6
    Views
    67

    So, the pointer in Z can either be a null pointer...

    So, the pointer in Z can either be a null pointer (resulting in a typical singly linked list), or it could point back to A (resulting in a circular singly linked list).
  4. Thread: Pointers

    by laserlight
    Replies
    6
    Views
    67

    Maybe a good old analogy will help: suppose I...

    Maybe a good old analogy will help: suppose I give you a namecard containing my company's office's address. You put this namecard into your pocket. "That's impossible!" I exclaim. "How could you have...
  5. Let's go back to the concepts that you're trying...

    Let's go back to the concepts that you're trying to express:

    What's a weapon? What does a weapon have? What does a weapon do? Do weapons exist independently of players such that they are created...
  6. Public inheritance typically models an "is-a"...

    Public inheritance typically models an "is-a" relationship. A player has one or more weapons (typically expressed by composition, or more loosely by aggregation/association), so you should not be...
  7. Instead of many weapon functions, consider...

    Instead of many weapon functions, consider defining a weapon class. You can then have two weapon objects per player, each representing a weapon in one hand. You would have a single function that...
  8. wxWidgets is C++, so this thread shall be moved...

    wxWidgets is C++, so this thread shall be moved to the C++ programming forum.

    As for your question: you need to learn about inheritance and polymorphism in C++. This is typically covered by...
  9. That's pretty much what I suggested that you do,...

    That's pretty much what I suggested that you do, except that I was willing to work through the errors that you initially faced so you can learn from it.
  10. You could have just tried again and showed the...

    You could have just tried again and showed the result. Since you have no proof, I conclude that you are mistaken, so my advice is to write: writeDes(name, code)
  11. How did it not work? What was the exact code that...

    How did it not work? What was the exact code that you tried and what was the error message?


    Except for spelling, that's equivalent to zach's current writeDes function.
  12. Haven't you tried writing writeDes(name, code)? ...

    Haven't you tried writing writeDes(name, code)?

    By the way, your printf calls that pass a string -- especially from user input -- as an argument via a variable should include a format string, even...
  13. Thread: Poor RyanC

    by laserlight
    Replies
    7
    Views
    152

    Were you the troll behind RyanC? *whacks*

    Were you the troll behind RyanC? *whacks*
  14. Replies
    2
    Views
    115

    You need to adjust the condition of the do while...

    You need to adjust the condition of the do while loop.
  15. Replies
    4
    Views
    122

    I suggest: Make it such that socket.h can be...

    I suggest:

    Make it such that socket.h can be included multiple times, anywhere.
    Come up with an interface for the functions in mydebug.h
    Implement the same interface in mydebugsocket.h, but...
  16. Replies
    1
    Views
    77

    Thankfully, since C++17, you probably won't need...

    Thankfully, since C++17, you probably won't need to use new unless you're writing lower level functionality that's beyond you anyway. Problem solved!
  17. Replies
    10
    Views
    181

    Tell you what: if you pay me $100, then I will...

    Tell you what: if you pay me $100, then I will transfer ownership of my house to you.

    Of course, when you pay me $100, I will then tell you: it is true that you've paid me $100, therefore I will...
  18. Replies
    8
    Views
    197

    No, it has nothing to do with terminals. You're...

    No, it has nothing to do with terminals. You're just doing it wrong. For example:

    #include <stdio.h>

    int main(void)
    {
    unsigned int numbers[] = {0, 1, 12, 123, 1234, 12345};
    for...
  19. Replies
    10
    Views
    181

    Because the people who came up with that language...

    Because the people who came up with that language feature weren't as prone to overthinking and confusing themselves as you are.
  20. Replies
    8
    Views
    197

    Are you aware that the format specifier for...

    Are you aware that the format specifier for printf has the notion of a field and field width, as well as fill character? You can just specify that the integer is to be printed with a field width of...
  21. Replies
    2
    Views
    129

    In the second example, you declared i but did not...

    In the second example, you declared i but did not initialise it, so it was given a garbage initial value. You probably wanted to write:

    int i = -1, p = -1;
  22. Post the smallest and simplest compilable program...

    Post the smallest and simplest compilable program that demonstrates the error. If possible, the input should be hard coded into the program, otherwise you should at the very least tell us what is the...
  23. Replies
    2
    Views
    119

    Yes, I remember you were trying to extend C, but...

    Yes, I remember you were trying to extend C, but this isn't C.

    *thread moved*
  24. Replies
    2
    Views
    132

    Yes, it would be simpler if that were all the...

    Yes, it would be simpler if that were all the input that you intended to read, but you might want to read an integer (using the overloaded operator>>), then read a string (using getline), and then...
  25. Thread: .cvs file

    by laserlight
    Replies
    4
    Views
    266

    Find a C library for parsing files/strings in CSV...

    Find a C library for parsing files/strings in CSV formats.

    If you're only talking about a specific CSV format that has a fixed number of floating point values per line to be stored as doubles,...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4