ねえ、私は現在、効率のためにさまざまな種類の種類を比較する宿題をやっています.しかし、データ要素にアクセスするのに問題があり、簡単な答えであるべきだと思うので、少しばかげています. これが私の主な機能です。
int main()
{
//declarations
int const MYARRAYSIZE = 100;
Sort mySort(MYARRAYSIZE);
mySort.init_array();
clock_t timeA = clock();
for(int i = 0; i < MYARRAYSIZE; i++)
{
//run tests
mySort.insertion_sort(/*whatgoeshere*/, MYARRAYSIZE );
}
clock_t timeB = clock();
clock_t diff = timeB - timeA;
system("PAUSE");
}
ここに私のヘッダーがあります
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();
};
myArray に格納されている配列にアクセスしようとしています。クラスだけがアクセスできることは理解していますが、どのようにアクセスすればよいでしょうか?