0

当我尝试编译此代码时,我不确定为什么会收到错误“GetClickCount identifier not found”。(我得到与 GetClickCount64 相同的错误)。我希望有人能解释一下。我对这个问题的大部分搜索似乎表明代码缺少 #include ,但这显然不是我的问题。

#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;
}
4

1 回答 1

1

尝试使用Environment::TickCount

于 2013-02-13T21:47:58.060 回答