本文整理汇总了C++中BinaryHeap::makeEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryHeap::makeEmpty方法的具体用法?C++ BinaryHeap::makeEmpty怎么用?C++ BinaryHeap::makeEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryHeap
的用法示例。
在下文中一共展示了BinaryHeap::makeEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runSim
int runSim(int a1, int a2, int a3){
BinaryHeap<Soldier> test;
test.buildSoldiers(a2, a3);
return test.events();
test.makeEmpty();
}
示例2: main
//.........这里部分代码省略.........
cout << "Persians remaining: " << persian_Count << endl;
sum_Persians = sum_Persians + persian_Count;
soldier_count_Persians.push_back(persian_Count);
cout << "The ID's of all our Spartans: " << endl;
file << "Output for simulation: " << i << endl;
file << "-----------------------" << endl;
file << "Remaining soldiers: " << endl;
file << "Spartans: " << spartan_Count << " Persians: " << persian_Count << endl;
//printOutIDs(alive_Spartans, total_Spartans);
cout << "The ID's of all our Persians: " << endl;
//printOutIDs(alive_Persians, total_Persians);
cout << "*****************************************************" << endl;
cout << "******************THE WINNER IS..********************" << endl;
if(spartan_Count == 0){
cout << "The Persians are victorious!" << endl;
numberOfPersianVictories++;
file << "The Persians have won simulation: " << i << endl;
}
else{
cout << "The Spartans are victorious!" << endl;
numberOfSpartanVictories++;
file << "The Spartans have won simulation: " << i << endl;
}
heap.makeEmpty();
spartan_Count = total_Spartans;
persian_Count = total_Persians;
alive_Spartans.clear();
alive_Persians.clear();
seconds_since_start = (double)(clock() - start)/CLOCKS_PER_SEC;
cout << "This battle took: " << seconds_since_start << " seconds." << endl;
file << "Battle " << i << " took a total of: " << seconds_since_start << " seconds." << endl;
time_Count.push_back(seconds_since_start);
sum_Time += seconds_since_start;
file << "------------------" << endl;
}
file << "~~~~~~~~~~~~~~~~~~~~~SIMULATIONS HAVE ENDED~~~~~~~~~~~~~~~~~~" << endl;
cout << "The Spartans have won: " << numberOfSpartanVictories << " time(s)" << endl;
cout << "The Persians have won: " << numberOfPersianVictories << " time(s)" << endl;
spartan_Final_Average = arithMean(sum_Spartans, numberOfTimes);
persian_Final_Average = arithMean(sum_Persians, numberOfTimes);
time_Final_Average = arithMean(sum_Time, numberOfTimes);
cout << "Average number of living Spartans: " << spartan_Final_Average << endl;
cout << "Average number of living Persians: " << persian_Final_Average << endl;
cout << "Average battle length: " << time_Final_Average << endl;
omega_Spartan = standard_deviation(soldier_count_Spartans, numberOfTimes, spartan_Final_Average);
omega_Persian = standard_deviation(soldier_count_Persians, numberOfTimes, persian_Final_Average);
omega_Time = standard_deviation(time_Count, numberOfTimes, time_Final_Average);