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

Search:

Type: Posts; User: 2kaud

Page 1 of 80 1 2 3 4

Search: Search took 0.12 seconds; generated 37 minute(s) ago.

  1. Re: parent process hangs when spawning child process

    No. The windows message loop isn't processing queued messages until the for loop terminates. progress->StepIt() is just queuing a message for processing. That's why the ui is not responsive until the...
  2. Replies
    4
    Views
    141

    Re: Problem while porting from 2008 to 2013

    The issue is the assignment. This compiles for MSVS2013


    bool converted (i >> level );


    For an assignment, you need to cast to bool


    bool converted = static_cast<bool>(i >> level );
  3. Replies
    4
    Views
    141

    Re: Problem while porting from 2008 to 2013

    As bool() operator is defined for stringstream for c++11, try


    bool converted = (i >> level);
  4. Re: parent process hangs when spawning child process

    Have you put a debugger break point on the if statement following the spawn to see when it is hit and the value of ret?
  5. Replies
    38
    Views
    942

    Re: error: expression must have a class type

    Because what you have is this


    for (size_t j = 0; j < n - i - 1; ++j)
    cmpCount++;


    if (arr[j] > arr[j + 1])
    {
    swap(arr[j], arr[j + 1]);
  6. Re: Need help: Looping user input for specific data type

    (toupper(cin.peek()) != 'Y') && (toupper(cin.peek()) != 'N')


    To simply the conditional tests, this could be replaced by


    ...
    const char *valid = "NY";
    ...
    !strchr(valid,...
  7. Re: Need help: Looping user input for specific data type

    (cin.peek() == '\n', ' ')


    You have a problem here. I don't think you intended to use the comma operator - as the value of that expression is always 32 (which is not zero so is evaluated to...
  8. Re: Need help: Looping user input for specific data type

    If you want to ignore newline and space then you probably want to ignore tab as well. You might want to consider using isspace(). See https://msdn.microsoft.com/en-us/library/y13z34da.aspx


    ...
  9. Replies
    21
    Views
    372

    Re: using std::list with a structure

    c is a reference so the const means that the contents of vct cannot be changed (by program accident!). Any attempt to change will cause a compile error. The const can be omitted and in this case will...
  10. Replies
    21
    Views
    372

    Re: using std::list with a structure

    Like this?



    #include <iostream>
    #include <vector>
    #include <algorithm>
    using namespace std;

    struct combi_t
  11. Replies
    21
    Views
    372

    Re: using std::list with a structure

    What are you trying to achieve?
  12. Replies
    21
    Views
    372

    Re: using std::list with a structure

    For completeness. Example of two ways of iterating a container (c++11)



    #include <list>
    #include <iostream>
    #include <iomanip>
    using namespace std;

    struct combi_t
  13. Replies
    21
    Views
    372

    Re: using std::list with a structure

    Yes, I realised after I posted as I was just using v0, v1 etc from your post #7. As you say, it should be val0, val1 etc as per my changed code in post #8.
  14. Replies
    21
    Views
    372

    Re: using std::list with a structure

    master_roller(combi_t.v0, combi_t.v1, combi_t.v2, num); //this call is wrong!!!


    combi_t is a class type, not a variable of a class instance. In my simple example in post #5, ct is the class...
  15. Replies
    21
    Views
    372

    Re: using std::list with a structure

    One simple way is as below. If you are after something different you'll need to provide more details.



    combi_t ct(3, 4, 5);

    do_something(ct.val0);
    do_something(ct.val1);...
  16. Replies
    21
    Views
    372

    Re: using std::list with a structure

    One way is to implement a constructor for combi_t. Example



    #include <list>
    using namespace std;

    struct combi_t
    {
    int val0;
  17. Replies
    1
    Views
    155

    Re: Help with exercise build address book in C

    You can pass my_addressbook to bubble sort and use strcmp() to compare the names so the array would be sorted in name order. Something like (not tried)


    void BubbleSort(ADDRESSBOOK...
  18. Replies
    4
    Views
    207

    Re: 2 D Arrays Adding Rows and Getting Averages

    So within computeSums() you'll need two loops - an inner one to loop over each column for a row and an outer one to iterate over the rows. For each row you'll need to compute the sum of its columns...
  19. Replies
    4
    Views
    207

    Re: 2 D Arrays Adding Rows and Getting Averages

    What are computeSums() and computeAvgs() supposed to do? - I don't think they are doing what you want them to. How are you supposed to call them?
  20. Replies
    38
    Views
    942

    Re: error: expression must have a class type

    Whilst knowing the various sorting algorithms is important, the interesting part is the different number of comparisons and data swaps that the various algorithms undertake with different types of...
  21. Replies
    7
    Views
    275

    Re: Can someone tell me what I am doing wrong

    As a class design point, why do the bstree member functions need to have nodeptr as a parameter? Surely this implementation detail should be hidden from the class user? and why are all the class...
  22. Replies
    7
    Views
    275

    Re: Can someone tell me what I am doing wrong

    You don't say what is the issue for which you are asking for guidance.

    Also your code is very hard to read as it is not indented.

    Assuming that the issue you have is with running the program...
  23. Replies
    38
    Views
    942

    Re: error: expression must have a class type

    Your insertion sort seems overly complicated. Try


    void insertionSort(int myarr[], int n)
    {
    for (size_t i = 1; i < n; ++i)
    for (size_t j = i; j > 0 && myarr[j - 1] > myarr[j]; --j)...
  24. Replies
    38
    Views
    942

    Re: error: expression must have a class type

    Yes. :)
  25. Replies
    38
    Views
    942

    Re: error: expression must have a class type

    I'm not quite sure how your bubble sort is supposed to work but a simple implementation of a bubble sort is


    void bubbleSort(int arr[], int n)
    {
    for (size_t i = 0; i < n - 1; ++i)
    for...
Results 1 to 25 of 1998
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center