I'm not sure why I get the error "GetClickCount identifier not found" when I try to compile this code. (I get the same error with GetClickCount64). I was hoping someone might be able to explain. Most of my serches on the problem seem to indicate that the code was lacking the #include , but that clearly isnt my problem.
#include <Windows.h>
#include "stdafx.h"
#include "InSort.h"
#include "DataSet.h"
using namespace std;
using namespace System;
ref class Test
{
public:
Test(){}
// TestInsertSortProcedure() method tests the InsertSort process for the duration
// of the sorting proceedure by checking the time prior to and after the SortCollection()
// method has run on five different lengths of the array being sorted, each subsequent length
// being 10-fold greater than the previous length
void TestInsertSortProcedure()
{
int start;
int finish;
int total;
unsigned int increment;
InSort<int>^ myInsertSorter = gcnew InSort<int>();
for (increment = 1; increment < 1000000; increment = increment * 10)
{
// get new dataset with new number of elements equal to increment value
Dataset^ myDataArray = gcnew Dataset(increment);
// Timestamp prior to sorting:
start = GetTickCount();
// Sort collection
myInsertSorter->SortCollection(myDataArray->unsortedArray);
// Timestamp at completion of sorting
finish = GetTickCount();
total = finish - start;
// Print result to console
Console::WriteLine(L"Sorting time in milliseconds was: " + total);
}
}
};
int main(array<System::String ^> ^args)
{
Test^ testing = gcnew Test();
testing->TestInsertSortProcedure();
return 0;
}
Try using Environment::TickCount