rm 1.tar.gz; wget --no-cache http://fabien.viger.free.fr/cpp/td14/1.tar.gz tar xf 1.tar.gz make 1.1RENDU: 1.1.cc
Hello
World This is a simple text file |
simple text file |
class MyObj {
public:
explicit MyObj(int seed); // Implemented in 2.1.test.cc
~MyObj(); // Implemented in 2.1.test.cc
// NOT default- and copy-constructible!
MyObj() = delete;
MyObj(const MyObj&) = delete;
int Value() const { return value_; }
private:
const int value_;
};
// This function, which you must implement, should do the following:
// - Construct N instances of MyObj, with seed=0...N-1.
// - Sort them by Value()
// - Return the "median" value, i.e. the Value() of the N/2-th MyObj in the
// sorted list.
// - [IMPORTANT!] Destroy all instances of MyObj before returning.
int ComputeMedianMyObj(int N);
Testez votre code:
rm 2.tar.gz; wget --no-cache http://fabien.viger.free.fr/cpp/td14/2.tar.gz tar xf 2.tar.gz make 2.1RENDU: 2.1.cc
class Hat {
public:
Hat() { ++num_hats_global_; }
~Hat() { --num_hats_global_; }
static int NumHatsGlobal() { return num_hats_global_; }
private:
static int num_hats_global_;
};
class HatFactory {
public:
// The factory constructs a new hat, and gives me a pointer to the
// newly constructed object. The caller does not own the Hat.
Hat* NewHat();
// All hats ever constructed are destructed when the factory is destructed.
~HatFactory();
private:
// TODO
};
Testez votre code:
rm 3.tar.gz; wget --no-cache http://fabien.viger.free.fr/cpp/td14/3.tar.gz tar xf 3.tar.gz make 3.1RENDU: 3.1.h et 3.1.cc