Professional Documents
Culture Documents
Tony Gaddis
Haywood Community College
The author and publisher of this book have used their best efforts in
preparing this book. These efforts include the development,
research, and testing of theories and programs to determine their
effectiveness. The author and publisher make no warranty of any
kind, expressed or implied, with regard to these programs or the
documentation contained in this book. The author and publisher shall
not be liable in any event for incidental or consequential damages
with, or arising out of, the furnishing, performance, or use of these
programs.
Title: Starting out with C++. From control structures through objects /
Tony Gaddis, Haywood Community College.
1 17
ISBN-13: 978-0-13-449837-9
ISBN-10: 0-13-449837-2
Contents at a Glance
Preface xvii
Index 1293
Credit 1311
Appendix E: Namespaces
Appendix K: Unions
2.5 Identifiers 42
2.6 Integer Data Types 43
2.13 Scope 62
2.15 Comments 71
Programming Challenges 81
3.3 When You Mix Apples and Oranges: Type Conversion 100
Index 1293
Credit 1311
Online The following appendices are available at
www.pearsonhighered.com/gaddis.
Appendix C: Introduction to Flowcharting
Appendix E: Namespaces
Appendix K: Unions
The Bisharin inhabit the desert beyond the narrow green strip along the Nile.
Their matting tents are easily moved from place to place in their search for
pasturage.
The railroads of Egypt and the Sudan are under the government,
and I find both systems pay. Those of Egypt earn about six per cent.
on their capital stock and their working expenses are only about
seventy-three per cent. of the gross receipts. The business is rapidly
increasing. They carry some twenty-six million passengers a year
and some five million tons of freight. Egypt now has something like
fifteen hundred miles of railroads which belong to the government,
and in addition more than seven hundred miles of agricultural roads
managed by private parties. The earnings of the latter are
increasing, for they carry more freight and passengers from year to
year.
The main lines are managed by Egyptian and European officials.
The superintendents of departments, who receive three thousand
dollars and upward a year each, are mainly Europeans, while the
inspectors and sub-inspectors, who get from eighty dollars to two
hundred and forty dollars a month, are in the main foreigners. Under
these men are the native guards, track workers, and mechanics of
various kinds, who receive smaller wages. They are almost all
Egyptians, there being some twenty-four hundred of them to about
one hundred and fifty Europeans.
The Sudan roads go through a thinly populated country, but the
receipts are already considerably more than their working expenses
and are rapidly increasing.
The Alexandria-Cairo division of the Cape-to-Cairo road taps one
of the richest countries on earth. I mean the delta of Egypt, which is
more thickly populated than most other parts of the globe. The
distance from Alexandria to Cairo is one hundred and thirty-three
miles, and all the way is through rich farm lands. There is no desert
in sight until you reach Cairo. Cotton is piled up at every depot, there
are vast loads of it on the canals which the track crosses, and at the
stations cars of cotton bales fill the side tracks.
The next division above Cairo goes to Asyut, which is two or three
hundred miles farther south. Then comes the road from Asyut to
Luxor, ending with the narrow-gauge line from Luxor to Aswan.
These divisions are through the narrow part of the Nile valley, with
the desert in sight all the time. The river winds this way and that, but
the railroad is comparatively straight, and is often far off from the
river amid the sand and rocks. Such parts of the line are
uncomfortable going. At times the sands are blinding, the dust fills
the cars, and our eyes smart. These discomforts are somewhat less
in the first-class cars. All of them have shutters and double windows
to keep out the dust, and the inner window panes are of smoked
glass to lessen the glare. With the shutters up it is almost dark and
when both windows are down the interior has the appearance of
twilight. When clear glass alone is used the rays are blinding and the
sun comes through with such strength that it is not safe to have it
strike the back of one’s neck. In addition to the double windows and
shutters there are wooden hoods over the car windows, so that the
direct rays of the sun may not shine in. The cars have also double
roofs, and the doors have windows of smoked glass. There is so
much dust that it comes in when everything is shut tight, and the
porter has to sweep up every hour.
I found the conditions even worse in the Nubian Desert, which I
crossed on the railroad from Wady Haifa, where I left the steamer
Ibis, to Berber. That region is about the dreariest and most desolate
on earth. It is all sand and rocks, with here and there a low barren
mountain. The Nubians themselves call it “the stone belly,” and the
name is well chosen.
The road through Nubia is a part of the Sudan military railway that
extends from Wady Halfa to Khartum. It is one of the iron gateways
to the Sudan, the other being the railway which the British have built
from Atbara to Port Sudan and Suakim on the Red Sea. The military
line is almost as long as from New York to Detroit and the Port
Sudan line from the Red Sea to Atbara, where it connects with the
military line, is less than half that length.
The Port Sudan road vies with the military railways in being one of
the dirtiest railroads ever constructed. Its whole route is across the
Nubian Desert. There is no vegetation at all between Atbara and the
Red Sea until within about nine miles of the coast, and then only a
scanty growth of thorn bush and scrub that feeds small flocks of
camels and sheep.
This Red Sea road was opened about 1905. Since then it has
been carrying a large part of the trade of the Sudan. Mohammedan
pilgrims from Central Africa and the Lower Nile valley use it on their
way to and from Mecca, and occasionally tourists come to Khartum
via the Suez Canal, the Red Sea, and this railroad.
The military line from Wady Halfa is the one built by General
Kitchener during the war with the Mahdi. Constructed in less than
eighteen months by the British engineers and soldiers, it is one of
the most remarkable examples of railroad building on record. A large
part of it was laid in the hottest time of the year and at the rate of one
and a quarter miles per day, and once, more than three miles were
laid in one day. Yet the work was so well done that heavy trains
could travel safely over it even when making twenty-five miles an
hour. It was built through a waterless desert which had never been
mapped until the railroad surveyors went over it. During its
construction the survey camp was kept about six miles in advance of
the rail head. The road was built through a hostile country where
there was constant danger of attack by the Dervishes.
To-day the cars move as smoothly over those tracks as they do
over those of Egypt, and give that country regular connection with
the Sudan. There is now a train de luxe connecting Khartum with
Wady Halfa equipped with sleeping and dining cars.
The sleepers are divided into compartments about seven feet
square with two berths to each. There is an aisle along the side of
the car from which the compartments are entered, and each of the
latter is large enough to enable one to have a wicker chair in it in
addition to the berths. Every little room has an electric fan and is
lighted by electricity.
The dining-car service is good and comparatively cheap. The
meals consist of a cup of tea and some crackers brought in by a
Nubian porter at daybreak; a breakfast in the dining car at eight
o’clock; a table d’hôte luncheon at one, and a dinner in the evening.
In riding over the Sudan military road we stopped for a time at
Atbara, where the Black Nile from Abyssinia flows into the main
stream. Here is the famous bridge built by Americans upon orders
given by General Kitchener. The contract was first offered to the
English, but they were not able to build the bridge in the time
required, so the Americans took the job and finished it. Atbara is now
an important division point where the road across the desert to the
Red Sea branches off. As we stopped at the station our engine
struck me as looking familiar. I walked to the front of the train and
examined it. Sure enough, it was a Baldwin, with the name
“Philadelphia” standing out in the full blaze of the Nubian sun. Later
on, when I crossed the Black Nile over the steel bridge put up by our
builders, I felt that I was not out of touch with home, after all. I was
being hauled by an American engine over an American bridge,
though I was in the heart of the Nubian Desert more than a thousand
miles up the Nile. The thought makes one proud of our American
enterprise and mechanical genius.
At Atbara I learned a great deal about the road, which starts here
on its three hundred and thirty mile journey through the Nubian
Desert to the Red Sea. This little town might be called one of the
railway centres of the Sudan. Lying at the junction of the two chief
railways, it has the principal railroad offices and shops and is the
home of the director, with whom I had a long talk about his line to the
Red Sea. He had a part in building the road and is now its manager.
We first visited the shops, which cover two or three acres of sandy
waste. They are great sheds with walls of galvanized iron and roofs
of iron and plate glass. I saw many locomotives, cars and steel ties,
and telegraph poles outside. Going in, I found all sorts of railway
repair and construction work under way. The machinists were a
mixture of whites, blacks, and yellows, representing a half-dozen
different nations and tribes. There were British overseers, Greek and
Italian mechanics, some Nubian blacksmiths, and many Nubian boys
taking a sort of manual-training course in order that they may serve
as locomotive engineers, under machinists and trackmen. The
machinery is of modern make and the shops are well equipped.
As we walked among the lathes and planing machines the director
pointed out to me some of the peculiarities of the wear and tear of
the desert upon railway materials.
“Here,” said he, as he pointed to the wheel of an American
locomotive, in which was cut a groove so deep and wide that I could
lay my three fingers in it, “is an example of how the sands ruin our
car wheels. The flint-like grains from the desert blow over the rails,
and as the cars move they grind out the steel as though they were
emery powder. Consequently, the life of a wheel is short, and we
have to cut down its tire every few months. Moreover, the sand gets
into the bearings, and there is a continual wearing which
necessitates almost constant repair.”
“How about your sandstorms? Are they serious obstacles to
traffic?”
“At times, yes. They come with such violence that they cover the
tracks; they cloud the sun so that when you are in one you cannot
see your hand before your face. They often spring up afar off, so that
you can watch them coming. At such times the sand gets into
everything and cuts its way through all parts of the machinery.
“Another thing we have to contend with,” continued the railway
manager, “is the extraordinary dryness of the air, which shrinks our
rolling stock so that it has to be tightened up again and again. One of
our passenger cars will shrink as much as eighteen inches in one
wall alone, and we have to put in extra boards to fill up the gaps. The
same is true of all sorts of woodwork.
“Another trouble is the white ant. That little termite eats anything
wooden. It chews up the insides of our cars and even attacks the
furniture. Where there is the least moisture the ants will go for the
railroad ties, and they will chew out the insides of the wooden
telegraph poles. They always work under cover, leaving a thin shell
of wood outside. The result is that a tie or pole may look sound then
all at once it will crumble to pieces. We have to inspect the road very
carefully at regular intervals and watch out for weak points. We now
use hollow steel tubes as ties. They do not make so smooth a road
as the wooden ties, but the ants cannot eat them. We also have
steel telegraph poles.”
“I noticed my train was pulled by an American locomotive. How do
they compare with those from Great Britain?” I inquired.
“Not well,” replied the railroad director. “We have some of your
engines which we bought seven years ago. We are still using them,
but most of them have been repaired and made over. You people
make locomotives, expecting to run them to their full capacity for four
or five years and then throw them on the scrap heap. This is not
advisable out here in the desert, where freight costs so much and
the trouble of getting our rolling stock is so great. We want
machinery that will stand all sorts of trials, including the climate. We
want it rustproof and rotproof and heavily made all around. We have
here not only the dry air and the sand to contend with, but also in the
neighbourhood of the Red Sea the salt air and the alkali water.”
“I suppose the lack of water is one of your chief difficulties, is it
not?” I asked.
“Yes. This railroad is over three hundred miles long and the track
is laid through the sand. For about one third of the distance inland
from the Red Sea the country is mountainous, but the rest of it is flat.
There are no streams, so we have to rely on artesian wells for our
water supply. We have bored a number, but we find that the water in
many places is salt. We struck one well which had three per cent. of
salt in it, and another in which the water was one per cent. salt. Of
course such water is useless for our locomotives.
“We are having trouble also in getting a good water supply at Port
Sudan. We sunk one well to a depth of eight hundred feet and struck
a good flow of fresh water. We had hardly completed, it, however,
before the salt water began to seep in, and we are now drilling again.
There are some stretches along the route where there is no water
whatever. In such places we have to carry our supply with us. For
this we have tanks of galvanized iron, each of which will hold about
fifteen hundred gallons.”
From Atbara I took a later train to continue my journey on toward
Khartum. About one hundred miles south of Atbara we stopped at
Shendi, where the Queen of Sheba is said to have lived. This is a
station on the east bank of the Nile five hours or more from Khartum.
It is a considerable town with railroad shops. I saw great piles of
steel ties such as Captain Midwinter mentioned.
The mud towers outside some Egyptian huts are used by whole families as cool
sleeping places out of reach of scorpions. Sometimes mothers leave their babies
in them while they are working in the fields.
The child so contentedly sucking sugar cane is, like four out of every hundred
children in Egypt, blind in one eye. This is due chiefly to the superstition and
ignorance of their parents.
Shendi consists of an old and a new town. The latter has been laid
out by the British and has a park in the centre watered by the Nile. In
ancient times there was a great city here, for it was the capital of the
country and the supposed residence of the Queen of Sheba, who
went from here down the Nile and crossed to Palestine. There she
had her famous flirtation with King Solomon. The Abyssinians say
that she went back by the Red Sea and stopped in their country; and
that while there she bore a son whose father was Solomon and who
became the head of the line of kings which rule Abyssinia to-day.
The Mohammedans, on the other hand, say that the Queen of
Sheba did not live here at all. They claim that her residence was in
Yemen, Arabia, and that Solomon went there to visit her. The
queen’s name was Balkis. As witty as she was beautiful, she gave
the wise Solomon many a riddle which he was puzzled to answer.
CHAPTER XIX
ACROSS AFRICA BY AIR AND RAIL