User Profile

Collapse

Profile Sidebar

Collapse
BEEMZA
BEEMZA
Last Activity: Sep 6 '07, 07:55 PM
Joined: Apr 21 '07
Location: Cape Town, South Africa
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • BEEMZA
    replied to dynamic allocation
    in C
    Thanks, it works with the default constructor :)
    See more | Go to post

    Leave a comment:


  • BEEMZA
    replied to dynamic allocation
    in C
    This worked fine until I added variables to the struct. The erro is as follows:

    main.cpp:46: error: no matching function for call to ‘VEdge::VEdge() ’
    VEdge.h:6: note: candidates are: VEdge::VEdge(in t, int, bool)
    VEdge.h:1: note: VEdge::VEdge(co nst VEdge&)

    I think it wants a constructor call of some sort...
    See more | Go to post

    Leave a comment:


  • BEEMZA
    started a topic dynamic allocation
    in C

    dynamic allocation

    Hi

    I am trying to create matrix of a struct I defined. It seems i cannot just sub in my struct name for float:

    Code:
    float **matrix;
    int rows = 10, cols = 10;
    matrix = new float* [rows];
    for(int i = 0; i<rows; i++)
    {
      matrix [i] = new float [cols];
    }
    What can I do instead?
    See more | Go to post

  • BEEMZA
    replied to creating an iterator
    in C
    Hi All

    Nevermind, I have found a solution :)
    See more | Go to post

    Leave a comment:


  • BEEMZA
    started a topic creating an iterator
    in C

    creating an iterator

    Hi All

    I am trying to implement a hash table using separate chaining. I have declared a vector of list [vector< list<string> > myList]. I am now trying to create a makeEmpty( ) method. But I am having trouble wih creating an iterator for the list embedded in the vector.

    Cna anyone help me out?

    Thanks
    See more | Go to post

  • BEEMZA
    replied to sorting a vector
    in C
    sorting vector continued.....

    I am trying to sort a vector containing objects of a class, using one of the instance variables as a key(int).

    I defined the operator overload as follows:

    Code:
    bool info::operator < (info &b){
    	return getWeight() < b.getWeight();
    	
    }
    In the driver i have included <algorithm> and am using the sort method as follows:
    ...
    See more | Go to post
    Last edited by AdrianH; Apr 22 '07, 08:55 PM. Reason: Added code tags

    Leave a comment:


  • BEEMZA
    replied to sorting a vector
    in C
    sorting vector

    Hi All

    I posted earlier.....
    I took advise on using the sort method in the STL under algorithms on a class that I created. Here is the operator overloading that i did but i cant seem to get it to sort at all. PLease help

    Code:
    bool info::operator < (info &b){
    	if ( (*this).getWeight() < b.getWeight() )
    	return true;
    	else
    	return false;
    }
    See more | Go to post
    Last edited by AdrianH; Apr 22 '07, 02:25 AM. Reason: Added code tags

    Leave a comment:


  • BEEMZA
    started a topic sorting a vector
    in C

    sorting a vector

    Hi All
    I was just wondering if its possible to use the sort method found in the STL algorithms class on a vector I declared as: " vector<myClass> myVector; "
    where I want to sort according to one of the instance varaibles of myClass.

    Thanks
    See more | Go to post
No activity results to display
Show More
Working...