arrays - Unable to access element from Sort class c++ -
hey doing homework assignment compare different kinds of sorts efficiency.however having trouble accessing data element , feel dumb because feel should easy answer. here main function.
int main() { //declarations int const myarraysize = 100; sort mysort(myarraysize); mysort.init_array(); clock_t timea = clock(); for(int = 0; < myarraysize; i++) { //run tests mysort.insertion_sort(/*whatgoeshere*/, myarraysize ); } clock_t timeb = clock(); clock_t diff = timeb - timea; system("pause"); }
and here header
class sort { private: int size; int *myarray; public: sort(int size); ~sort(); friend ostream& operator << (ostream& out, const sort& s) { //put code in here } void insertion_sort(int [], int); void selection_sort(int [], int); void merge_sort(int [], int); void quick_sort(int [], int); void partition(int [], int, int&); void merge(int [], int, int); void init_array(); int getsize(); };
i trying access array stored in myarray , understand class can access it, how go accessing it?
/* whatgoeshere* /
nothing goes there.
remove arguments member functions
example :
just use:
void insertion_sort( );
this knows myarray
, size
data members of class
and call as
mysort.insertion_sort( );
this considers member functions implemented correctly using myarray
, size
.
Comments
Post a Comment