1
0
Fork 0

add inputs for ex4.1, ex4.3, ex5.2, ex5.3

This commit is contained in:
Frank Filthaut 2019-11-14 22:12:20 +01:00 committed by Eric Teunis de Boone
parent ec8df55672
commit b313ad8364
13 changed files with 305 additions and 0 deletions

17
ex4.1/Button.hh Normal file
View File

@ -0,0 +1,17 @@
#ifndef BUTTON_HH
#define BUTTON_HH
#include <iostream>
class Button {
public:
Button() { std::cout << "Button Constructor " << this << std::endl ; }
Button(const Button&) { std::cout << "Button Copy Constructor " << this << std::endl ; }
~Button() { std::cout << "Button Destructor " << this << std::endl ; }
private:
} ;
#endif

13
ex4.1/Cable.hh Normal file
View File

@ -0,0 +1,13 @@
#include <iostream>
class Cable {
public:
Cable() { std::cout << "Cable Constructor " << this << std::endl ; }
Cable(const Cable&) { std::cout << "Cable Copy Constructor " << this << std::endl ; }
~Cable() { std::cout << "Cable Destructor " << this << std::endl ; }
private:
} ;

17
ex4.1/Chassis.hh Normal file
View File

@ -0,0 +1,17 @@
#ifndef CHASSIS_HH
#define CHASSIS_HH
#include <iostream>
class Chassis {
public:
Chassis() { std::cout << "Chassis Constructor " << this << std::endl ; }
Chassis(const Chassis&) { std::cout << "Chassis Copy Constructor " << this << std::endl ; }
~Chassis() { std::cout << "Chassis Destructor " << this << std::endl ; }
private:
} ;
#endif

20
ex4.1/Dialer.hh Normal file
View File

@ -0,0 +1,20 @@
#include <iostream>
#ifndef DIALER_HH
#define DIALER_HH
#include "Button.hh"
class Dialer {
public:
Dialer() { std::cout << "Dialer Constructor " << this << std::endl ; }
Dialer(const Dialer&) { std::cout << "Dialer Copy Constructor " << this << std::endl ; }
~Dialer() { std::cout << "Dialer Destructor " << this << std::endl ; }
private:
Button buttons[12] ;
} ;
#endif

16
ex4.1/Earpiece.hh Normal file
View File

@ -0,0 +1,16 @@
#include <iostream>
#ifndef EARPIECE_HH
#define EARPIECE_HH
class Earpiece {
public:
Earpiece() { std::cout << "Earpiece Constructor " << this << std::endl ; }
Earpiece(const Earpiece&) { std::cout << "Earpiece Copy Constructor " << this << std::endl ; }
~Earpiece() { std::cout << "Earpiece Destructor " << this << std::endl ; }
private:
} ;
#endif

25
ex4.1/Handset.hh Normal file
View File

@ -0,0 +1,25 @@
#include <iostream>
#ifndef HANDSET_HH
#define HANDSET_HH
#include "Mouthpiece.hh"
#include "Earpiece.hh"
#include "Cable.hh"
class Handset {
public:
Handset() { std::cout << "Handset Constructor " << this << std::endl ; }
Handset(const Handset&) { std::cout << "Handset Copy Constructor " << this << std::endl ; }
~Handset() { std::cout << "Handset Destructor " << this << std::endl ; }
private:
Mouthpiece mouthpiece ;
Earpiece earpiece ;
Cable cable ;
} ;
#endif

22
ex4.1/Housing.hh Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
#ifndef HOUSING_HH
#define HOUSING_HH
#include "Chassis.hh"
#include "Shell.hh"
class Housing {
public:
Housing() { std::cout << "Housing Constructor " << this << std::endl ; }
Housing(const Housing&) { std::cout << "Housing Copy Constructor " << this << std::endl ; }
~Housing() { std::cout << "Housing Destructor " << this << std::endl ; }
private:
Chassis chassis ;
Shell shell ;
} ;
#endif

16
ex4.1/Mouthpiece.hh Normal file
View File

@ -0,0 +1,16 @@
#include <iostream>
#ifndef MOUTHPIECE_HH
#define MOUTHPIECE_HH
class Mouthpiece {
public:
Mouthpiece() { std::cout << "Mouthpiece Constructor " << this << std::endl ; }
Mouthpiece(const Mouthpiece&) { std::cout << "Mouthpiece Copy Constructor " << this << std::endl ; }
~Mouthpiece() { std::cout << "Mouthpiece Destructor " << this << std::endl ; }
private:
} ;
#endif

17
ex4.1/Shell.hh Normal file
View File

@ -0,0 +1,17 @@
#ifndef SHELL_HH
#define SHELL_HH
#include <iostream>
class Shell {
public:
Shell() { std::cout << "Shell Constructor " << this << std::endl ; }
Shell(const Shell&) { std::cout << "Shell Copy Constructor " << this << std::endl ; }
~Shell() { std::cout << "Shell Destructor " << this << std::endl ; }
private:
} ;
#endif

25
ex4.1/Telephone.hh Normal file
View File

@ -0,0 +1,25 @@
#ifndef TELEPHONE_HH
#define TELEPHONE_HH
#include "Cable.hh"
#include "Housing.hh"
#include "Dialer.hh"
#include "Handset.hh"
class Telephone {
public:
Telephone() { std::cout << "Telephone Constructor " << this << std::endl ; }
Telephone(const Telephone&) { std::cout << "Telephone Copy Constructor " << this << std::endl ; }
~Telephone() { std::cout << "Telephone Destructor " << this << std::endl ; }
private:
Cable cable ;
Housing housing ;
Dialer dialer ;
Handset handset ;
} ;
#endif

28
ex4.3/String.hh Normal file
View File

@ -0,0 +1,28 @@
#ifndef STRING_HH
#define STRING_HH
class String {
public:
String(const char* str="") : _s(0) { insert(str) ; }
String(const String& a) : _s(0) { insert(a._s) ; }
~String() { delete[] _s ; }
int length() const { return _len ; }
const char* data() const { return _s ; }
private:
char* _s ;
int _len ;
void insert(const char* str) { // private helper function
_len = strlen(str) ;
if (_s) delete[] _s ;
_s = new char[_len+1] ;
strcpy(_s,str) ;
}
} ;
#endif

9
ex5.2/data1.txt Normal file
View File

@ -0,0 +1,9 @@
586
2746
348946
-472
72734
-283
263
0
4957

80
ex5.3/example.txt Normal file
View File

@ -0,0 +1,80 @@
The upscale food court in the Time Warner Center can be derided for
many reasons, but a lack of clear marking is not among them. From the
moment you walk into the center, no matter which entrance you use, you
encounter signs pointing the way to the preciously termed "restaurant
and bar collection" a few stories up.
But during a lunchtime visit to one of the restaurants last fall I
encountered a well-dressed gentleman, perhaps in his early 60's, who
paced before the elevators on the ground level. In a confused voice he
asked me the location of the restaurant Per Se, where he had a coveted
reservation.
"The fourth floor," I said. He stared at me quizzically. I gestured to
one of those signs. I repeated my answer. Finally he climbed aboard an
elevator with me. But I could tell that he still had doubts. He seemed
unable to believe that one of Manhattan's most ambitious new
restaurants was high above the street in a corner of a shopping mall.
In fact four of Manhattan's most ambitious new restaurants are in this
"vertical retail environment," as its promoters prefer to call
it. Their eagerness to euphemize underscores the boldness of their
experiment: asking New York diners to consider elevators, escalators
and bright indoor lighting appropriate visual preludes to extremely
expensive dinners.
Nearly a year since the center opened it is still too soon to tell
whether that experiment will literally pay off. But those restaurants
- Per Se, Masa and V Steakhouse on the fourth floor and Café Gray on
the third - have been operating long enough for answers to other
questions. How crucially is fine dining affected by an unusual
physical context? What is it like to cross yards of gleaming marble
and brave the glaring seductions of Samsung and Sephora on the way to
and from an appointment with foie gras?
It is usually disconcerting. It is sometimes disorienting. Alongside
the restaurants on the fourth floor is a bar, the Stone Rose, whose
music echoes up and down the hall, trapped under the same roof. I left
Masa one night and felt my post-toro tranquility shatter under the
oppressive beat and incongruous lyrics of "Hungry Like the Wolf." I
was irritated like the coyote.
But an hour and then a day later I did not remember Masa less fondly
or long to return less ardently. The layout and gestalt of the Time
Warner Center were annoyances, but they were ignorable. The center
proves that restaurants transcend their trappings, a truth that was
often overlooked as culinary connoisseurs fretted about celebrated
chefs like Thomas Keller and Jean-Georges Vongerichten setting up
kitchens in the kind of structure that often bestrides a highway
access road.
For New Yorkers the center is a jarring development but also a
positive one. Without it Mr. Keller, the head chef of Per Se, might
not have set up a kitchen here at all. Because the center is a
mixed-use development in which the restaurants lend cachet to the
residences and office space, Mr. Keller could be offered an economic
safety net, a deal that insulated him from financial failure.
Mr. Vongerichten, the supervising chef of V Steakhouse, benefited from
a similar arrangement, and the aggregate glitter of these two helped
to lure Masayoshi Takayama, the chef at Masa, and Gray Kunz of Café
Gray. The four restaurants that they guide - plus a fifth, under the
stewardship of the chef Charlie Trotter, to come sometime over the
next year - probably wouldn't exist without their atypical commercial
cradle.
Would they be more appealing at street level, with sidewalks in front
and portals that admitted natural light? In most ways, yes. Their odd
situations yield unsettling effects. After hours in the dimly lighted
fantasy of Per Se, a diner is thrust not into moonbeams and fresh air
but into the harshly illuminated, stale reality of the rest of the
center. A cold slap punctuates a warm hug.
Or sometimes the rest of the center is thrust upon a diner. One night
I watched a woman and her two teenage daughters, all three dressed in
white Capri pants and brightly colored T-shirts, march straight into
Masa and then into Per Se, just to have a look. Understandably they
treated the exclusive restaurants on the fourth floor the way they had
treated stores on the lower three, as crannies of a mall that invited
exploration.