0

コードを実行すると、常に 0 が表示されますが、ブレークポイントを使用すると、タイマーを使用しているコードの一部で動作します。

case 'I':{ 
  auto startTime = chrono::high_resolution_clock::now(); //start the clock
  numbers.InsertionSort();//sorts the array using insertion sort method
  auto endTime = chrono::high_resolution_clock::now();//ends the clock
  cout<<"Insertion Sort of size: "<<numbers.GetSize()<<" took: "  
      <<chrono::duration_cast<chrono::milliseconds>(endTime-startTime).count() 
      <<" Millisecond"<<endl; //ouput the result to the screen
  break;//exit
}

標準のタイマーを使ってみましたが精度が足りなかったのでクロノタイマーにしました。先生は結果をミリ秒単位で出力してほしいと言っています。だから私はその期間を使用しています

4

0 に答える 0