Search:

Type: Posts; User: serge

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    8
    Views
    168

    This is awesome, thank you! I knew there is a...

    This is awesome, thank you! I knew there is a trick to pulling that struct outside. Yes, Dial member was not used, sorry about that. Initially I thought I would need it to demonstrate the issue.
  2. Replies
    8
    Views
    168

    Here is a full example the definition that does...

    Here is a full example the definition that does not work, I guess, because of the Motor declaration in Car. I don't see how an external definition can work. Error: "Unknown type name 'Motor' Motor...
  3. Replies
    8
    Views
    168

    I think I have not explained it properly in my...

    I think I have not explained it properly in my last post. I apologize for this.

    The issue I have is this:


    struct Car
    {
    struct Motor : Gauge
    {
    Motor(int dial) : Gauge(dial)...
  4. Replies
    8
    Views
    168

    OK, thank you for this explanation. I am nesting...

    OK, thank you for this explanation. I am nesting Motor in Car because I want Motor to use methods of Car:

    For example:



    struct Motor : Gauge
    {
    Motor(int dial) : Gauge(dial) {}
    void...
  5. Replies
    8
    Views
    168

    Ouside declaration of a nested struct/class

    Hello, why does this code with a nested struct compile, whereas moving the nested struct definition of Motor outside of the Car (commented out) and deleting the inside declaration produces an error?...
  6. OK, I got this, thank you! But what I am trying...

    OK, I got this, thank you! But what I am trying to accomplish is something like this, where I want to call the overridden functions of the array elements. Can you help me do this?


    #include...
  7. Assessing Elements of a Struct in a Vector of Struct

    Hello all!

    Why can I read the name from a weapon stored in loadout, but cannot set its value (i.e. disable is always false). Thank you very much for your help!


    struct Weapon
    {
    bool...
  8. Replies
    1
    Views
    392

    Counter will not increment

    Hello! In the code below, why does the counter not increment if I use Template arguments?


    #include <iostream>

    using namespace std;

    struct parent
    {
    int counter = 0;
  9. Replies
    2
    Views
    126

    OK thx that fixed it! The other problem was that...

    OK thx that fixed it! The other problem was that the output of Scatter was recast to a fixed 0, so I got rid of the types in the functions.
  10. Replies
    2
    Views
    126

    Passing random seed/device to a function

    Hello! I am trying to pass a seed to several functions, each generating one random number from different distribution, e.g. This does not work, as each iteration (function call) produces the same...
  11. If I do as below, then A.w1 and A.w2 remain at...

    If I do as below, then A.w1 and A.w2 remain at their default values, i.e. with A.w1.name = "Weapon" instead of A.w1.name = "Gun 1". How can I make sure that w1 and w2 get passed to Player with all of...
  12. I am rethinking the design and getting the hang...

    I am rethinking the design and getting the hang of manipulating structures. Yes, it got messy with functions once more than a single variable was needed to be returned.

    One question that bothers...
  13. Probably out of my ignorance (I am a total...

    Probably out of my ignorance (I am a total beginner) it simply appears easier to work with an array of weapons, easier to iterate through a loadout, easier to change a loadout by pointing to a new...
  14. Please forget my pervious post. I think an array...

    Please forget my pervious post. I think an array of functions would be best solution. But how can I include Weapons class in the Player class, so that a specific loadout can be chosen when a Player...
  15. OK, I admit that I did not get very far - it...

    OK, I admit that I did not get very far - it became complicated fast.

    Below my attempt to put a skeleton with generic and derived classes. In particular, I could not pass more than one weapon to...
  16. My first steps in objective oriented programming. Why/How to overload a function?

    Hello all,

    here is my first attempt at object oriented programming in cpp, a goofy duel game.

    Below my first implementation.

    What I am stuck with is this:

    There can be potentially many...
  17. Replies
    1
    Views
    306

    Help with random numbers

    Hello!

    I would be grateful if someone could explain why this code produces identical random numbers (vectors). I am trying to generate a series of uniform and (flat)-dirichlet distributed random...
  18. Replies
    5
    Views
    1,367

    Red Hat Enterprise Linux Server release 6.6...

    Red Hat Enterprise Linux Server release 6.6 (Santiago)
  19. Replies
    5
    Views
    1,367

    Yes Tim, just figured that out myself (after...

    Yes Tim, just figured that out myself (after looking at the https://gcc.gnu.org/projects/cxx0x.html ). Sorry for wasting everyone's time! Have a nice day. S
  20. Replies
    5
    Views
    1,367

    Problems compiling c++11

    Dear all

    I wanted to check out the <random> library for the upcoming simulation project, but I get an error compiling this simple program taken from the very entertaining video by Stephan T....
  21. Replies
    11
    Views
    787

    thanks a lot for this info! But you would not...

    thanks a lot for this info! But you would not argue for no optimization if you are concerned about the accuracy (64bit) as I am? I will run some tests of speed vs accuracy.
  22. Replies
    11
    Views
    787

    this would be bad news for me, as I just ran tons...

    this would be bad news for me, as I just ran tons of math calculations over the last weeks using that option. So I hope you're right!
  23. Replies
    11
    Views
    787

    compiler optimization and num accuracy?

    Hello all

    I could not find anything I could understand on this, so I have heard that -O3 option may reduce the numerical accuracy of doubles. Is this true?

    s
  24. Replies
    13
    Views
    810

    I am calling an .exe file that produces console...

    I am calling an .exe file that produces console output. I cannot change anything about that. Collecting row outputs of all threads to a single stream is not a good idea, they may arrive in random...
  25. Replies
    13
    Views
    810

    Yes, I understand that am not separating things...

    Yes, I understand that am not separating things properly, and that the functions cannot be used as is.



    This is not possible, because each tread (instance of integrate) has its own stream with...
Results 1 to 25 of 79
Page 1 of 4 1 2 3 4