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

Search:

Type: Posts; User: ertss

Page 1 of 2 1 2

Search: Search took 0.03 seconds.

  1. How to save memory by using bit-precision in C++?

    Hi, I have met a confusing problem.
    For example, one square can have 5 states: labeled 1, labeled 2, labeled 3, empty, blocked.
    They theoretically I could just use 3 bits to hold the information...
  2. Replies
    13
    Views
    1,048

    Re: Need urgent help on my homework! Due day soon!

    Thanks nuzzle, I will give the two bitset way some thoughts.

    If I understood it correctly, are you saying creating a new class object which include two bitset to represent the bits?

    For...
  3. Replies
    13
    Views
    1,048

    Re: Need urgent help on my homework! Due day soon!

    TheGreatCthulhu, thanks for helping me to explain this. Yes, i am using the "combined" form to represent
    both input at once such that this could be used in the next steps of the alogorithm.
    ...
  4. Replies
    13
    Views
    1,048

    Re: Need urgent help on my homework! Due day soon!

    3 just represent the bit that could be either 1 or 0. We just don't care this bit because either choice will yield the same output result.
  5. Replies
    13
    Views
    1,048

    Re: Need urgent help on my homework! Due day soon!

    Sorry for the confusing part.
    For example, for a boolean function, there are 4 inputs ABCD, one output K;
    if for both the input patterns 1000 and 1001, the output is 1.
    Then we say we 'dont care'...
  6. Replies
    13
    Views
    1,048

    Need urgent help on my homework! Due day soon!

    Hi all,

    I'm programming an algorithm which needs to operate on bits. I know C/C++ has bitset class. But it is not enough for
    me. Because I also need to do the operation with x(don't care) bit...
  7. Re: How to do this sorting of a list of class type?

    Problem solved, thanks a lot.
    I write my code like this.


    #include <iostream>
    #include <vector>
    #include <list>
    #include <algorithm>

    using namespace std;
  8. Re: How to do this sorting of a list of class type?

    Could you write a small example code showing me how to provide < operator for node_info?
    Is that something called operator overload?
    I will try to look up the book for that part.
  9. Re: What's the time complexity of sorting a list using list.sort()

    I got it Russco,
    Thanks a lot!
  10. How to do this sorting of a list of class type?

    Hi all,
    I have got a list of class type that I need to do list.sort() on.
    the class type is


    class node_info{
    public:
    node_number;
    node_gain;
    }
  11. Re: What's the time complexity of sorting a list using list.sort()

    And it looks like the second sort cannot be used on list type.
    If i do something like this, it doesn't work... why is that?


    #include <algorithm>
    #include <list>
    ... ...
    list<int> ilist;
    ......
  12. What's the time complexity of sorting a list using list.sort()

    Hi all,

    Could any tell me what's the difference between the two kinds of sorting function listed below?
    Do they all have nlogn time complexity? It looks like the later one is in the algorithm...
  13. Re: cin.clear() question: Not able to clear the status of cin stream

    Thanks a lot Philip!
    u r the best.
  14. cin.clear() question: Not able to clear the status of cin stream

    Hi all,
    I have a small piece of code that I want to do a series of function of while(cin>>temp) kind of operation.
    But if i input 8 and 9 then enter an non-integer number, the program run past the...
  15. Re: How to generate a List of ordering of 4! in C++

    Thanks a lot Paul, Best to you!
  16. How to generate a List of ordering of 4! in C++

    Hi All,
    I want to write a func to generate all the permutations of L[1,2,3,4], once at a time and output it in an array...
    For example, the first time the func called, it outputs a pointer to...
  17. Replies
    6
    Views
    5,713

    Re: How to manipulate vector of class type in C++

    Thank you Eri523! That helps a lot!
    But I met another problem with my code using getline(cin,temp);
    I changed my code to this. The thing is, the first time in the do...while loop, everything is...
  18. Replies
    6
    Views
    5,713

    Re: How to manipulate vector of class type in C++

    Thank you Drmmr.
    But I still didn't get how to use push_back when you are dealing with a vector of class type.
    For example, in my code, the class type has two private members 'price' and 'title'....
  19. Replies
    6
    Views
    5,713

    How to manipulate vector of class type in C++

    Hi all,
    I built a class type 'books' which includes the title and the price of a particular book. And I want to use vectors to store all the books information I have. This code should be able to get...
  20. Re: How to input white space with type std::string?

    OK, thanks!
    I tried


    getline(cin,temp)


    And it worked.
  21. Re: How to input white space with type std::string?

    How to use the getline?
    I tried


    string temp;
    cin.getline(temp,20);


    Should I include a header file to make that work?
  22. How to input white space with type std::string?

    Hi all,
    When the following code is executed, we cannot input any string with white-space.
    What if I actually want to input several words separated by white-spaces? How should I do that

    Thanks in...
  23. Replies
    13
    Views
    1,459

    Re: Class member initialization help

    yes... GCDEF, I know what you mean. I'm now reading C++ Primer, although it seems to be a little bit hard for me...
  24. Replies
    13
    Views
    1,459

    Re: Class member initialization help

    Paul, I don't think it's because of the use of char[] or string type;
    Because the same error still pointed to the constructor usage after I changed the type.
  25. Replies
    13
    Views
    1,459

    Re: Class member initialization help

    I still cannot figure out what's the problem...
    I think I must have misused the default constructor... I did it following a youtube tutorial...
    I attached the code from the tutorial and could you...
Results 1 to 25 of 33
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured