编程练习答案——第16章
1 // chapter16.h 2 3 4 #ifndef LEARN_CPP_CHAPTER16_H 5 #define LEARN_CPP_CHAPTER16_H 6 7 #include <iostream> 8 #include <string> 9 #include <cctype> 10 #include <vector> 11 #include <ctime> 12 #include <cstdlib> 13 #include <fstream> 14 #include <algorithm> 15 #include <queue> 16 #include <list> 17 #include <memory> 18 19 void ch16_1(); 20 void ch16_2(); 21 void ch16_3(); 22 int reduce(long * ar, int n); 23 void ch16_4(); 24 template<class T> 25 int reduce2(T * ar, int n); 26 void ch16_5(); 27 bool newcustomer(double x); 28 void ch16_6(); 29 std::vector<int> lotto(int n, int select); 30 void ch16_7(); 31 void ch16_8(); 32 void ch16_9(); 33 34 struct Review { 35 std::string title; 36 int rating; 37 }; 38 bool operator<(const Review & r1, const Review & r2); 39 bool worseThan(const Review & r1, const Review & r2); 40 bool FillReview(Review & rr); 41 void ShowReview(const std::shared_ptr <Review> & rr); 42 void ch16_10(); 43 44 #endif //LEARN_CPP_CHAPTER16_H