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

Search:

Type: Posts; User: raptor88

Page 1 of 3 1 2 3

Search: Search took 0.02 seconds.

  1. Replies
    8
    Views
    1,600

    Re: keyword extern

    Thanks for your info.
    Raptor
  2. Replies
    8
    Views
    1,600

    Re: keyword extern

    Thanks for that clarification.
    Raptor
  3. Replies
    8
    Views
    1,600

    Re: keyword extern

    Hi Paul,

    Could you explain the difference between using "extern" on a function verses a global function?

    Say I create two files named Globals.h and Globals.cpp.

    I code a function in...
  4. Re: Does MS Visual C++ 2010 Express work in windows 8 Pro?

    Scratch this question. I found that VS "Express" 2012 is free. I was probably looking at the non Express version before.

    Answers for the other questions still needed though.

    Thanks,
    Raptor
  5. Does MS Visual C++ 2010 Express work in windows 8 Pro?

    The "Windows 8 compatibility assistant" says that Visual C++ 2010 Express installed in my Vista laptop is not compatible with Windows 8 Pro. However, I've learned that many programs that Win8's...
  6. Replies
    16
    Views
    3,916

    Re: Vector iterators

    AH HA MOMENT!

    I can see now that when the vector of structs is instantiated, space for the string is not allocated "within" the struct. Just a pointer to the string is the actual member in the...
  7. Replies
    16
    Views
    3,916

    Re: Vector iterators

    This is what I'm trying to understand. How is the sizeof(MyStruct) the same for every struct when there is a variable length string in the struct? Without a variable length member in the struct...
  8. Replies
    16
    Views
    3,916

    Re: Vector iterators

    Totally right. Being new to C++, I used the parenthesis for "myVect(8)" in my actual test code but used the [] in my example here. Thanks for catching that.



    My understanding is that a vector...
  9. Replies
    16
    Views
    3,916

    Re: Vector iterators. How do they work with strings in a struct?

    A new question regarding vectors and iterators.

    I declared a struct that contains integers and one string. Then I instantiated a vector to hold the structs and set the total number of structs. ...
  10. Replies
    16
    Views
    3,916

    Re: Vector iterators

    I wrote a test program and yes, pre-increment doesn't skip the first element. Goggling shows that a for loop works like a while loop with the increment occurring at the end of the loop. Also...
  11. Replies
    16
    Views
    3,916

    Re: Vector iterators

    Understand. Going back to your previous post, why is pre-increment faster than post-increment? And won't pre-increment skip the first element in the for loop?

    Thanks,
    Raptor
  12. Replies
    16
    Views
    3,916

    Re: Vector iterators

    Actually no, I'm not preferring method-3 because of less typing. Method-2 uses "vector<int>::size_type" in place of Method-3's "unsigned" which is not that much more typing.


    Method 2:
    for...
  13. Replies
    16
    Views
    3,916

    Re: Vector iterators

    I put my question in that form to simplify what I was trying to ask. My basic question was whether Method-3 should always work under the conditions I set. Just trying to understand how vector...
  14. Replies
    16
    Views
    3,916

    Vector iterators

    C++ beginner learning how to use vectors.

    I see that there are 3 ways to iterate through a vector.



    Method 1:
    for(vector<int>::iterator it = myVect.begin(); it != myVect.end(); it++)
    ...
  15. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    My bad Paul. In hindsight I can see why you think my plan is to code most everything using globals and not using classes. The code I posted was just extending your example to verify whether my...
  16. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Would that be moving the enum statement before the struct statement?


    Since I need to access the betInfoMap[4] in my "GetBets", "PayBets" and on every iteration of the crap table drawing routine...
  17. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Is this the correct way to use Paul's code of the map of structs in an array for 4 players?



    #include "stdafx.h"
    #include <string>
    #include <iostream>
    #include <map>

    using namespace std;
  18. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Thanks for clearing that up Paul. Learned a lot from this thread. I did plan to only use your method in the future since it's easier to type but now I know it also works better.

    Thanks,
    Raptor
  19. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Guess I need to do more research since I really don't understand why the code I showed works different from Pauls. Thanks for pointing that out.
  20. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    For other beginning C++ learners, here's a substitute for Paul's struct code. Tested and it works identically.



    // The following code is equivalent to Paul's struct code and it works...
  21. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Yes, I did realize that but failed to say that "structs are like classes except they are always public by default". Thanks for clarifying it just in case I didn't realize it.



    Yes, once one...
  22. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Hi Paul,

    Thank you very much for taking the time to explain your code. Who would have guessed that even structs can have constructors. C++ books and web tutorials are so simplistic that they...
  23. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    OK, am more than willing to buy another C++ book. Please tell me the name of a book that explains what Paul did with his constructor statement within a struct. None of my 6 or 7 C++ books nor hours...
  24. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    Hi Paul,

    Going over your code, that's an extremely clever method of setting up the structure so it can be initialized in the format you show in main. I Googled for over 2 hours and could never...
  25. Replies
    23
    Views
    4,565

    Re: Which container to do what I need?

    That is really helpful Paul. I'll try to figure out how to use that for 4 players. Maybe an array to hold the maps.

    Thanks!
    Raptor
Results 1 to 25 of 57
Page 1 of 3 1 2 3





Click Here to Expand Forum to Full Width

Featured