Search:

Type: Posts; User: chinesepirate

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    153
    Views
    680,791

    Sticky: Heh, thanks. I read every page except page 1 :o ...

    Heh, thanks. I read every page except page 1 :o Guess I should have clicked once more.
  2. Replies
    153
    Views
    680,791

    Sticky: Any recommendations on good Design Pattern books?...

    Any recommendations on good Design Pattern books? Have been using them at work a lot, but I am trying to learn to write/implement them on my own.
  3. Replies
    1
    Views
    1,185

    Never mind I figured it out. For anyone...

    Never mind I figured it out. For anyone wondering, this is how I went about it:



    HANDLE hPrinter=NULL;
    DWORD dwBytesNeeded=0;
    PRINTER_INFO_2* pinfo2=NULL;


    if (OpenPrinter(name.c_str(),...
  4. Replies
    1
    Views
    1,185

    Identifying Printer Model

    What I want to do is detect a certain model of printer, but currently the only way of seeing what printer it is that I know of is using the DEVMODE struct which contains the device name. The problem...
  5. Replies
    3
    Views
    1,041

    Okay I think I understand that part, but when I...

    Okay I think I understand that part, but when I want to print the formula in infix notation how can I know when to print the parenthesis???
  6. Replies
    3
    Views
    1,041

    Reading formula from a file

    This isn't so much C++ related as it is to making a general algorithm, but since the program will be written in C++ I decided to post it here.

    Basically, the program needs to read a text file...
  7. Replies
    17
    Views
    3,236

    All of this could have been avoided if you said...

    All of this could have been avoided if you said "Is this correct?" And actually tried to do it, then ask for help.
  8. Hey thanks, that worked I didn't know you had...

    Hey thanks, that worked

    I didn't know you had to have a separate template for the friend function
  9. Its created in the insert function

    Its created in the insert function
  10. ^^ error C2679: binary '

    ^^

    error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'BinaryTree<T>' (or there is no acceptable conversion)

    Which doesn't make sense because I don't see...
  11. binarytree.cpp #include using...

    binarytree.cpp

    #include <iostream>
    using namespace std;

    template <class T>
    class BinaryTree{
    public:
    BinaryTree(T);
    BinaryTree<T>* insert(T, BinaryTree<T>*);
  12. Yes its a pointer, I tried this as well: ...

    Yes its a pointer, I tried this as well:


    friend ostream& operator<<(ostream&, const BinaryTree<T>*);

    And implementation:


    template <class T>
    ostream& operator<<(ostream& out, const...
  13. If i do this: template ostream&...

    If i do this:


    template <class T>
    ostream& operator<< (ostream& out, const BinaryTree<T>& bt){
    out << bt.data;
    return out;
    }

    cout << t; just prints a memory address
  14. Trying to overload

    So that if I have a binary tree:



    BinaryTree<int> *t = new BinaryTree<int>(5);


    And there have been more numbers inserted I can just say:
  15. Replies
    8
    Views
    1,219

    Eh I figured it out, just changed return type to...

    Eh I figured it out, just changed return type to Set<T>*
  16. Replies
    8
    Views
    1,219

    I wanted to return my definition of a Set I...

    I wanted to return my definition of a Set

    I did try Set<T> before I posted this, and it gives me 1 error:

    error C2664: 'Set<T>::Set(int)' : cannot convert parameter 1 from 'Set<T> *' to 'int'
    ...
  17. Replies
    8
    Views
    1,219

    Template problem

    I'm back :)

    Here is my Set class:


    template <class T>
    class Set{
    private:
    T *arr;
    int size;
  18. Replies
    19
    Views
    6,749

    Looks like I'll do some more reading, thanks :)

    Looks like I'll do some more reading, thanks :)
  19. Replies
    19
    Views
    6,749

    Ok that works, but it looks to me like I am...

    Ok that works, but it looks to me like I am deleting arr and then somehow setting a non existent object equal to arr2?

    Since it works that clearly isn't the case, but strange.
  20. Replies
    19
    Views
    6,749

    Ok, this is on the same program, but not entirely...

    Ok, this is on the same program, but not entirely related, just didn't want to make a new thread:

    This is my insert function:


    template <class T>
    void Set<T>::insert(T val){...
  21. Replies
    19
    Views
    6,749

    Ok thanks, fixed it.

    Ok thanks, fixed it.
  22. Replies
    19
    Views
    6,749

    I have a question on this code: int main()...

    I have a question on this code:


    int main()
    {
    char *substr;
    char str[] = "(1,3,4,1,2,5,2,6)";
    substr = strtok( str, "(),");
    int x = atoi(substr);
    while (substr)
  23. Replies
    19
    Views
    6,749

    Is there a way for me to pass the numbers as an...

    Is there a way for me to pass the numbers as an int into a function

    Like for example the first solution posted the substring is a char* but I need it to be an int

    Cast? atoi?(dunno if this...
  24. Replies
    19
    Views
    6,749

    Ok this works, but I have 2 questions. 1. Why...

    Ok this works, but I have 2 questions.

    1. Why a 0 as the first argument for strtok in the while loop? I have used them in C but doesn't make sense with a 0

    2. VS 2008 gives me the following...
  25. Replies
    19
    Views
    6,749

    Tokenizing user input

    Here is what I am trying to do:

    User inputs a set of objects (not in the programming sense) that could be say an int, string, char, etc.

    For this case, we will assume ints, so input would be...
Results 1 to 25 of 33
Page 1 of 2 1 2