0% found this document useful (0 votes)
22 views

Computer Programming 1st Edition E. Balagurusamy - The ebook is ready for download with just one simple click

The document provides information about various programming ebooks available for instant download at ebookgate.com, including titles by E. Balagurusamy and others. It highlights the ease of access to digital formats such as PDF, ePub, and MOBI. Additionally, it includes details about the author E. Balagurusamy and the contents of his book 'Computer Programming, 1st Edition'.

Uploaded by

metsolaisin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Computer Programming 1st Edition E. Balagurusamy - The ebook is ready for download with just one simple click

The document provides information about various programming ebooks available for instant download at ebookgate.com, including titles by E. Balagurusamy and others. It highlights the ease of access to digital formats such as PDF, ePub, and MOBI. Additionally, it includes details about the author E. Balagurusamy and the contents of his book 'Computer Programming, 1st Edition'.

Uploaded by

metsolaisin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Instant Ebook Access, One Click Away – Begin at ebookgate.

com

Computer Programming 1st Edition E. Balagurusamy

https://ebookgate.com/product/computer-programming-1st-
edition-e-balagurusamy/

OR CLICK BUTTON

DOWLOAD EBOOK

Get Instant Ebook Downloads – Browse at https://ebookgate.com


Click here to visit ebookgate.com and download ebook now
Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Programming in ANSI C 6th Edition E. Balagurusamy

https://ebookgate.com/product/programming-in-ansi-c-6th-edition-e-
balagurusamy/

ebookgate.com

C Programming Data Structures 4th Edition E. Balagurusamy

https://ebookgate.com/product/c-programming-data-structures-4th-
edition-e-balagurusamy/

ebookgate.com

Computer Programming for Teens 1st Edition Mary E. Farrell

https://ebookgate.com/product/computer-programming-for-teens-1st-
edition-mary-e-farrell/

ebookgate.com

Advanced Computer Programming in Python 1st Edition Karim


Pichara

https://ebookgate.com/product/advanced-computer-programming-in-
python-1st-edition-karim-pichara/

ebookgate.com
Computer Arithmetic Volume I Earl E Swartzlander

https://ebookgate.com/product/computer-arithmetic-volume-i-earl-e-
swartzlander/

ebookgate.com

Practical programming An introduction to computer science


using Python Jennifer Campbell

https://ebookgate.com/product/practical-programming-an-introduction-
to-computer-science-using-python-jennifer-campbell/

ebookgate.com

Programming with Java A Primer 3 e 3rd Edition E.


Balaguruswamy

https://ebookgate.com/product/programming-with-java-a-primer-3-e-3rd-
edition-e-balaguruswamy/

ebookgate.com

Mathematics for 3D Game Programming and Computer Graphics


Second Edition Eric Lengyel

https://ebookgate.com/product/mathematics-for-3d-game-programming-and-
computer-graphics-second-edition-eric-lengyel/

ebookgate.com

Numerical Computer Methods Part E 1st Edition Michael L.


Johnson

https://ebookgate.com/product/numerical-computer-methods-part-e-1st-
edition-michael-l-johnson/

ebookgate.com
As per
JNTU-Hyderabad
Syllabus regulation
2013

Computer Programming
First Edition
About the Author

E Balagurusamy, former Vice Chancellor, Anna University, Chennai, is currently Member, Union Public
Service Commission, New Delhi. He is a teacher, trainer, and consultant in the fields of Information
Technology and Management. He holds an ME (Hons) in Electrical Engineering and PhD in Systems
Engineering from the Indian Institute of Technology, Roorkee. His areas of interest include Object-Oriented
Software Engineering, Electronic Business, Technology Management, Business Process Re-engineering, and
Total Quality Management.
A prolific writer, he has authored a large number of research papers and several books. His best selling
books, among others, include:
• Computing Fundamentals and C Programming
• Fundamentals of Computers
• Programming in C#, 3/e
• Programming in Java, 4/e
• Object-Oriented Programming with C++, 5/e
• Programming in BASIC, 3/e
• Programming in ANSI C, 5/e
• Numerical Methods
• Reliability Engineering
A recipient of numerous honours and awards, he has been listed in the Directory of Who’s Who of
Intellectuals and in the Directory of Distinguished Leaders in Education.
As per
JNTU-Hyderabad
Syllabus regulation
2013

Computer Programming
First Edition

E Balagurusamy
Chairman
EBG Foundation
Coimbatore

McGraw Hill Education (India) Private Limited


NEW DELHI

McGraw Hill Education Offices


New Delhi New York St Louis San Francisco Auckland Bogotá Caracas
Kuala Lumpur Lisbon London Madrid Mexico City Milan Montreal
San Juan Santiago Singapore Sydney Tokyo Toronto
McGraw Hill Education (India) Private Limited
Published by McGraw Hill Education (India) Private Limited
P-24, Green Park Extension, New Delhi 110 016

Computer Programming, 1e
Copyright © 2014, by McGraw Hill Education (India) Private Limited.
No part of this publication may be reproduced or distributed in any form or by any means, electronic, mechanical,
photocopying, recording, or otherwise or stored in a database or retrieval system without the prior written permission of
the publishers. The program listing (if any) may be entered, stored and executed in a computer system, but they may not
be reproduced for publication.
This edition can be exported from India only by the publishers,
McGraw Hill Education (India) Private Limited.

ISBN (13): 978-93-5134-2939


ISBN (10): 93-5134-293X
Vice President and Managing Director: Ajay Shukla
Head—Higher Education Publishing and Marketing: Vibha Mahajan
Publishing Manager (SEM & Tech. Ed.): Shalini Jha
Editorial Researcher—Acquisitions: S. Vamsi Deepak
Manager—Production Systems: Satinder S Baveja
Assistant Manager—Editorial Services: Sohini Mukherjee
Senior Production Executive: Suhaib Ali
Assistant General Manager—Higher Education (Marketing): Vijay Sarathi
Senior Product Specialist: Tina Jajoriya
Senior Graphic Designer—Cover: Meenu Raghav
General Manager—Production: Rajender P Ghansela
Production Manager—Reji Kumar

Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be reliable.
However, neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any information
published herein, and neither McGraw Hill Education (India) nor its authors shall be responsible for any errors, omissions,
or damages arising out of use of this information. This work is published with the understanding that McGraw Hill Education
(India) and its authors are supplying information but are not attempting to render engineering or other professional services.
If such services are required, the assistance of an appropriate professional should be sought.

Typeset at Text-o-Graphics, B-1/56, Aravali Apartment, Sector-34, Noida 201 301, and printed at

Cover Printer:
Content

Preface xv
Roadmap to the Syllabus xix

1. Introduction to Computers 1.1-1.50


1.1 Introduction 1.1
1.2 Computer Systems 1.2
1.2.1 Input Devices 1.3
1.2.2 CPU 1.5
1.2.3 Output Devices 1.6
1.2.4 Memory 1.8
1.3 Programming Languages 1.12
1.3.1 Machine Language 1.12
1.3.2 Assembly Language 1.12
1.3.3 High-Level Languages 1.13
1.3.4 Procedure-oriented Languages 1.14
1.3.5 Problem-oriented Languages 1.14
1.3.6 Natural Languages 1.14
1.4 Programming Environment 1.15
1.5 Creating and Running Programs 1.15
1.5.1 Structured Programming 1.15
1.5.2 System Development Tools 1.16
1.5.3 Developing a Program 1.18
1.5.4 Running a Program 1.21
1.6 Software Development Method 1.22
1.6.1 Analysing the Requirements 1.23
1.6.2 Feasibility Analysis 1.23
1.6.3 Creating the Design 1.24
1.6.4 Developing Code 1.24
1.6.5 Testing the Software 1.25
1.6.6 Deploying the Software 1.25
1.6.7 Maintaining the Software 1.25
vi Contents

1.7 Applying Software Development Method 1.25


1.8 Problem Solving 1.27
1.9 Algorithms 1.27
1.9.1 Characteristics of Algorithms 1.28
1.9.2 Advantages of Algorithms 1.28
1.9.3 Disadvantages of Algorithms 1.28
1.10 Flowcharts 1.30
1.10.1 Flowchart Design Rules 1.33
1.10.2 Advantages of Flowcharts 1.33
1.10.3 Disadvantages of Flowcharts 1.33
1.11 Pseudocodes 1.36
1.11.1 Pseudocode Rules 1.37
1.11.2 Advantages of Pseudocodes 1.37
1.11.3 Disadvantages of Pseudocodes 1.37
1.12 Problem Solving Examples 1.40
Just Remember 1.46
Multiple Choice Questions 1.47
Review Questions 1.48
Key Terms 1.49

2 Introduction to C 2.1-2.147
2.1 Introduction 2.1
2.2 Overview of C 2.2
2.2.1 History of C 2.2
2.2.2 Characteristics of C 2.4
2.2.3 Sample Program 1: Printing a Message 2.4
2.2.4 Sample Program 2: Adding Two Numbers 2.7
2.2.5 Sample Program 3: Interest Calculation 2.8
2.2.6 Sample Program 4: Use of Subroutines 2.10
2.2.7 Sample Program 5: Use of Math functions 2.11
2.3 Basic Structure of C Programs 2.13
2.4 Programming Style 2.13
2.5 Executing A ‘C’ Program 2.14
2.6 UNIX System 2.15
2.7 C Character Set 2.17
2.7.1 Trigraph Characters 2.19
2.8 C Tokens 2.19
2.9 Keywords and Identifiers 2.20
2.10 Constants 2.21
2.10.1 Integer Constants 2.21
2.10.2 Real Constants 2.22
2.10.3 Single Character Constants 2.23
2.10.4 String Constants 2.24
2.11 Variables 2.24
2.12 Data Types 2.25
Contents vii

2.12.1 Integer Types 2.26


2.12.2 Floating Point Types 2.27
2.12.3 Void Types 2.27
2.12.4 Character Types 2.27
2.13 Declaration of Variables 2.27
2.13.1 Primary Type Declaration 2.28
2.13.2 User-defined Type Declaration 2.29
2.14 Declaration of Storage Class 2.30
2.15 Assigning Values to Variables 2.31
2.15.1 Assignment Statement 2.32
2.15.2 Reading Data from Keyboard 2.34
2.15.3 Declaring a Variable as a Constant 2.36
2.15.4 Declaring a Variable as Volatile 2.36
2.16 Case Studies 2.37
2.16.1 Calculation of Average of Numbers 2.37
2.16.2 Temperature Conversion Problem 2.38
2.17 Managing Input and Output Operations 2.39
2.17.1 Reading a Character 2.39
2.17.2 Writing a Character 2.42
2.17.3 Formatted Input 2.43
2.17.4 Points to Remember while Using scanf 2.50
2.17.5 Formatted Output 2.50
2.18 Case Studies 2.55
2.19 Operators and expressions 2.59
2.19.1 Arithmetic Operators 2.59
2.19.2 Relational Operators 2.61
2.19.3 Logical Operators 2.62
2.19.4 Assignment Operators 2.63
2.19.5 Increment and Decrement Operators 2.65
2.19.6 Conditional Operator 2.66
2.19.7 Bitwise Operators 2.67
2.19.8 Special Operators 2.67
2.19.9 Operator Precedence 2.69
2.19.10 Precedence of Arithmetic Operators 2.70
2.19.11 Some Computational Problems 2.72
2.19.12 Type Conversions in Expressions 2.73
2.19.13 Operator Precedence and Associativity 2.75
2.20 Case Studies 2.78
2.21 Decision making and branching 2.79
2.21.1 Decision Making with if Statement 2.80
2.21.2 The switch Statement 2.90
2.21.3 The goto Statement 2.92
2.22 Case Studies 2.94
2.23 Decision making and looping 2.98
2.23.1 The while Statement 2.99
2.23.2 The do Statement 2.100
viii Contents

2.23.3 The for Statement 2.102


2.23.4 Jumps in Loops 2.107
2.24 Jumping out of the Program 2.112
2.25 Structured Programming 2.112
2.26 Case Studies 2.113
Just Remember 2.142
Review Questions 2.144
Multiple Choice Questions 2.145
Programming Exercise 2.146

3A. Functions 3A.1-3A.45


3A.1 Introduction 3A.1
3A.2 Need for User-defined Functions 3A.1
3A.3 A Multi-function Program 3A.2
3A.4 Elements of user-defined Functions 3A.4
3A.5 Definition of Functions 3A.4
3A.5.1 Function Header 3A.5
3A.5.2 Name and Type 3A.5
3A.5.3 Formal Parameter List 3A.5
3A.5.4 Function Body 3A.6
3A.6 Return Values and their Types 3A.7
3A.7 Function Calls 3A.8
3A.8 Function Declaration 3A.9
3A.9 Category of Functions 3A.11
3A.10 No Arguments and no Return Values 3A.11
3A.11 Arguments but no Return Values 3A.13
3A.12 Arguments with Return Values 3A.15
3A.13 No Arguments but Returns a Value 3A.18
3A.14 Functions that Return Multiple Values 3A.19
3A.15 Nesting of Functions 3A.20
3A.16 Recursion 3A.21
3A.17 The Scope, Visibility and Lifetime of Variables 3A.22
3A.17.1 Automatic Variables 3A.23
3A.17.2 External Variables 3A.24
3A.17.3 Static Variables 3A.328
3A.17.4 Register Variables 3A.29
3A.17.5 Nested Blocks 3A.30
3A.18 Multifile Programs 3A.31
3A.19 Preprocessor Commands 3A.32
3A.19.1 Macro Substitution Directives 3A.33
3A.19.2 File Inclusion Directive 3A.35
3A.19.3 Conditional Inclusion Directives 3A.35
3A.19.4 Additional Preprocessor Directives 3A.36
Just Remember 3A.37
Multiple Choice Questions 3A.38
Contents ix

Case Study 3A.39


Review Questions 3A.41
Programming Exercises 3A.44
Key Terms 3A.45

3B. Arrays 3B.1-3B.79


3B.1 Introduction 3B.1
3B.2 One-Dimensional Arrays 3B.2
3B.3 Declaration of one-dimensional Arrays 3B.3
3B.4 Initialization of one-dimensional Arrays 3B.5
3B.4.1 Compile Time Initialization 3B.6
3B.4.2 Run Time Initialization 3B.6
3B.5 Two-Dimensional Arrays 3B.14
3B.6 Initializing Two-Dimensional Arrays 3B.18
3B.7 Multi-Dimensional Arrays 3B.21
3B.8 Dynamic Arrays 3B.22
3B.9 Passing Arrays to Functions 3A.22
3B.9.1 One-Dimensional Arrays 3A.22
3B.9.2 Two-Dimensional Arrays 3A.26
3B.10 Passing Strings to Functions 3A.27
3B.11 More About Arrays 3B.27
3B.12 C Programming Examples – Built-in Functions 3B.58
Just Remember 3B.63
Multiple Choice Questions 3B.63
Case Study 3B.64
Review Questions 3B.75
Programming Exercises 3B.77
Key Terms 3B.79

4A. Pointers 4A.1-4A.35


4A.1 Introduction 4A.1
4A.2 Understanding Pointers 4A.1
4A.3 Accessing the Address of a Variable 4A.3
4A.4 Declaring Pointer Variables 4A.4
4A.5 Initialization of Pointer Variables 4A.5
4A.6 Accessing a Variable Through its Pointer 4A.6
4A.7 Chain of Pointers 4A.8
4A.8 Pointer Expressions 4A.9
4A.9 Pointer Increments and Scale Factor 4A.10
4A.10 Pointers and Arrays 4A.11
4A.11 Pointers and Character Strings 4A.14
4A.12 Array of Pointers 4A.16
4A.13 Pointers as Function Arguments 4A.16
4A.14 Functions Returning Pointers 4A.19
x Contents

4A.15 Pointers to Functions 4A.19


4A.16 Introduction 4A.22
4A.17 Dynamic Memory Allocation 4A.23
4A.18 Allocating a Block of Memory: Malloc 4A.23
4A.19 Allocating Multiple Blocks of Memory: Calloc 4A.25
4A.20 Releasing the Used Space: Free 4A.26
Just Remember 4A.26
Multiple Choice Questions 4A.27
Case Study 4A.28
Review Questions 4A.33
Programming Exercises 4A.34
Key Terms 4A.35

4B. Strings 4B.1-4B.30


4B.1 Introduction 4B.1
4B.2 Declaring and Initializing String Variables 4B.2
4B.3 Reading Strings From Terminal 4B.3
4B.3.1 Using scanf Function 4B.3
4B.3.2 Reading a Line of Text 4B.5
4B.3.3 Using getchar and gets Functions 4B.5
4B.4 Writing Strings to Screen 4B.7
4B.4.1 Using printf Function 4B.7
4B.4.2 Using putchar and puts Functions 4B.10
4B.5 Arithmetic Operations on Characters 4B.11
4B.6 Putting Strings Together 4B.12
4B.7 Comparison of Two Strings 4B.14
4B.8 String-Handling Functions 4B.14
4B.8.1 strcat() Function 4B.14
4B.8.2 strcmp() Function 4B.15
4B.8.3 strcpy() Function 4B.15
4B.8.4 strlen() Function 4B.16
4B.8.5 strncpy() Function 4B.17
4B.8.6 strncmp() Function 4B.17
4B.8.7 strncat() Function 4B.18
4B.8.8 strstr() Function 4B.18
4B.9 Table of Strings 4B. 19
4B.10 Other Features of Strings 4B. 20
4B.11 String / Data Conversion 4B. 20
Just Remember 4B. 22
Multiple Choice Questions 4B. 22
Case Study 4B. 23
Review Questions 4B. 27
Programming Exercises 4B. 29
Key Terms 4B.30
Contents xi

5. Structures and Unions 5.1-5.59


5.1 Introduction 5.1
5.2 Defining a Structure 5.1
5.3 Declaring Structure Variables 5.2
5.4 Accessing Structure Members 5.4
5.5 Structure Initialization 5.5
5.6 Copying and Comparing Structure Variables 5.7
5.7 Operations On Individual Members 5.8
5.8 Arrays of Structures 5.9
5.9 Arrays Within Structures 5.11
5.10 Structures Within Structures 5.12
5.11 Pointers and Structures 5.14
5.12 Structures and Functions 5.17
5.13 Unions 5.20
5.14 Size of Structures 5.21
5.15 Bit Fields 5.22
5.16 Typedef 5.24
5.17 Enum 5.24
5.18 Command Line Arguments 5.38
5.19 Application of Command Line Arguments 5.48
Just Remember 5.50
Multiple Choice Questions 5.51
Case Study 5.52
Review Questions 5.55
Programming Exercises 5.58
Key Terms 5.59

6. File Management in C 6.1-6.19


6.1 Introduction 6.1
6.2 Types of Files 6.2
6.3 Defining and Opening a File 6.3
6.4 Closing a File 6.4
6.5 Input/Output Operations on Files 6.4
6.5.1 The getc and putc Functions 6.5
6.5.2 The getw and putw Functions 6.6
6.5.3 The fprintf and fscanf Functions 6.8
6.6 Error Handling During I/O Operations 6.10
6.7 Random Access to Files 6.12
Just Remember 6.16
Multiple Choice Questions 6.17
Review Questions 6.18
Programming Exercises 6.19
Key Terms 6.19
xii Contents

7. Sorting and Searching Techniques 7.1-7.23


7.1 Introduction 7.1
7.2 Sorting 7.1
7.2.1 Sorting Efficiency 7.2
7.2.2 Exchange Sorting—Bubble Sort 7.3
7.2.3 Exchange Sorting—Quick Sort 7.5
7.2.4 Selection Sort 7.8
7.2.5 Merge Sort 7.10
7.2.6 Simple Insertion Sort 7.12
7.2.7 Shell Sort 7.13
7.3 Searching 7.15
7.3.1 Linear Search 7.15
7.3.2 Binary Search 7.16
7.3.3 Indexed Sequential Search 7.19
Just Remember 7.22
Multiple Choice Questions 7.22
Review Questions 7.23

8. Data Structures 8.1-8.52


8.1 Introduction 8.1
8.2 Abstract Data Types 8.2
8.3 Linear List 8.2
8.3.1 Linked Lists Operations 8.5
8.3.2 Implementation 8.10
8.3.3 Linked List with Header 8.16
8.4 Stacks 8.17
8.4.1 Stack Operations 8.18
8.5 Stack Implementation 8.18
8.5.1 Array Implementation of Stacks 8.19
8.5.2 Linked Implementation of Stacks 8.23
8.6 Applications of Stacks 8.27
8.6.1 Infix Notation 8.27
8.6.2 Prefix Notation 8.27
8.6.3 Conversion from Infix to Prefix Notation 8.28
8.6.4 Evaluation of Prefix Expression 8.31
8.6.5 Postfix Notation 8.32
8.6.6 Conversion from Infix to Postfix Notation 8.32
8.6.7 Evaluation of Postfix Expression 8.36
8.7 Queues 8.36
8.7.1 Queue Operations 8.37
8.8 Queue Implementation 8.38
8.8.1 Array Implementation of Queues 8.38
8.8.2 Linked Implementation of Queues 8.44
Contents xiii

Just Remember 8.49


Multiple Choice Questions 8.49
Review Questions 8.50
Programming Exercises 8.52

Appendix A A.1-A.12

Solved Question Papers


June 2011 Set 1 1.1–1.6
June 2011 Set 2 2.1–2.8
June 2011 Set 3 3.1–3.7
June 2011 Set 4 4.1–4.11

June 2012 SQP SET 1.1–1.8


Preface

The developments in digital electronics and related technologies during the last few decades have ushered
in the second Industrial Revolution that is popularly referred to as the Information Revolution. Computer
technology plays an ever-increasing role in this new revolution. Today, the application of computers is all
pervasive in everybody’s life. A sound knowledge of how computers process data and information has,
therefore, become indispensable for anyone who seeks employment not only in the area of IT but also in any
other field.

COMPUTER PROGRAMMING
Computer programming is dedicated to writing, testing and maintaining programs that computers follow to
perform their functions. To create programs that control the behaviour of a machine, we need programming
languages. This book enables students to master the necessary skills for computer programming with C
language and shows them how to use these skills wisely with data structures and algorithms.

THE C PROGRAMMING LANGUAGE


C is a general-purpose structured programming language that is powerful, efficient and compact. C combines
the features of a high-level language with the elements of the assembler and is thus close to both man and
machine. The growth of C during the last few years has been phenomenal. It has emerged as the language
of choice for most applications due to its speed, portability and compactness of code. It has now been
implemented on virtually every sort of computer, from micro to mainframe.
Rightly so, many institutions and universities in India have introduced a subject covering Computer
Programming. This book is specially designed for the first-year students studying the foundation course
in the first semester of Jawaharlal Nehru Technological University (JNTU).

DATA STRUCTURES
Data structures are prevalent in almost every program, since they provide specialised formats of storing and
organising data in a computer. This book presents the design and implementation of data structures using
standard ANSI C programming language.
xvi Preface

WHY IS THIS BOOK A WINNER?


• This book is completely in sync with the new syllabus prescribed by JNTU, effective August 2009.
– It offers comprehensive coverage of topics related to Data Structures, Linked Lists, Queues,
Stacks (important as per the new syllabus).
– New chapters on Fundamentals of Computers and Computing Concepts cover two new units in
the revised syllabus. These chapters clearly explain the basics of computers, thereby providing
a strong foundation for mastering advanced topics on programming and data structures given in
successive chapters.
• This book incorporates all the features of ANSI C that are essential for a C programmer. The ANSI
standards are explained in detail at appropriate places (noted in the text by a special mention for the
convenience of our readers).
• From a learner to a skilled C programmer, this book ensures smooth and successful transition. The
concept of ‘learning by example’ has been stressed throughout the book. Every important feature
of the language is treated in depth followed by a complete program example to illustrate its use.
Case studies at the end of chapters not only describe the common ways in which C features are put
together but also show real-life applications. Wherever necessary, pictorial descriptions of concepts
are included to facilitate better understanding. Thus, this book succeeds at presenting a contemporary
approach to programming with a unique combination of theory and practice.
• It highly appeals to the students because of focused coverage of syllabus, variety of programs and
simple theory.

PEDAGOGICAL FEATURES
• Bottom-up approach of explaining concepts.
• Algorithms and flowcharts are covered extensively.
• Codes and comments illustrate the use of various features of the language.
• Special boxes feature supplementary information and notes that complement the text.
• Case studies in relevant chapters demonstrate real-life applications.
• Just remember section lists out helpful hints and possible problem areas.
• Review questions (132) provide ample opportunities to test the conceptual understanding.
• Programming exercises (135) simulate interest to practice programming applications.
• Solved examples and programs (200) have been tested using compilers compatible to both UNIX
and MS-DOS operating systems and, wherever appropriate, the nature of output has been discussed.
These programs also demonstrate the general principles of a good programming style.
• Multiple choice questions (179) help students test their conceptual understanding of the subject.
• Lab assignments are given as per the new syllabus.
• Updated with information on compiler C-99 supported by numerous programs (12) using C-99.
• Solutions to 2011 exam question papers (4 sets) and 2012 exam question paper.
Preface xvii

HOW IS THE BOOK ORGANISED


The content is spread over 10 chapters. Chapter 1 introduces computer systems, programming languages
and environment, software development method, algorithms, flowcharts and pseudocodes. Chapter 2 gives
an overview of C and explains keywords, identifiers, constants, variables, data types and various case studies
on these. Chapters 3A and 3B discuss arrays and functions respectively, whereas pointers and strings are
covered in Chapters 4A and 4B. Chapter 5 presents structures and unions. Chapter 6 deals with file
management in C. Sorting and searching techniques are covered in Chapter 7. Finally, Chapter 8 presents
data structures.
There is also an Appendix and Solved Question Papers of June 2011 and June 2012 at the end of the book.

CD RESOURCES
The book is accompanied with a CD which provides the following resources:
• All lab assignments
• Previous years’ solved university question papers
• 208 additional objective/ review/ debugging type questions pertaining to each unit
• 5 Model Question Papers
The supplementary CD helps students master the programming language and write their own programs
using Computer programming concepts and data structures.

ACKNOWLEDGEMENTS
The author is grateful to Mrs Nagaratna Parameshwar Hegde of Vasavi College of Engineering, Hyderabad
for her useful comments and suggestions.

E Balagurusamy

PUBLISHER’S NOTE
McGraw Hill Education (India) looks forward to receiving from teachers and students their valuable views,
comments and suggestions for improvements, all of which may be sent to tmh.corefeedback@gmail.com
(mentioning the title and author’s name). Also, please inform any observations on piracy related issues.
Roadmap to the Syllabus
COMPUTER PROGRAMMING
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

Module 1: Introduction to Computers—Computer Systems, Computing Environments, Computer


Languages, Creating and running programs, Program Development.
Introduction to the C Language—Background, C Programs, Identifiers, Types, Variables, Constants,
Input 1 Output, Operators (Arithmetic, relational, logical, bitwise etc.), Expressions, Precedence and
Associativity, Expression Evaluation, Type conversions, Statements—Selection Statements (making
decisions)—if and switch statements, Repetition statements ( loops)-while, for, do-while statements, Loop
examples, other statements related to looping break, continue, goto, Simple C Program examples.

GO TO:
CHAPTER 1. Introduction to Computers
CHAPTER 2. Introduction to C

Module 2: Functions-Designing Structured Programs, Functions, user defined functions, inter function
communication, Standard functions, Scope, Storage classes-auto, register, static, extern, scope rules, type
qualifiers, recursion–recursive functions, Limitations of recursion, example C programs, Preprocessor
commands.
Arrays—Concepts, using arrays in C, inter function communication, array applications, two-dimensional
arrays, multidimensional arrays, C program examples.

GO TO:
CHAPTER 3A. Functions
CHAPTER 3B. Arrays

Module 3: Pointers—Introduction (Basic Concepts), Pointers for inter function communication, pointers
to pointers, compatibility, Pointer Applications-Arrays and Pointers, Pointer Arithmetic and arrays,
Passing an array to a function, memory allocation functions, array of pointers, programming applications,
pointers to void, pointers to functions.
Strings—Concepts, C Strings, String Input I Output functions, arrays of strings, string manipulation
functions, string I data conversion, C program examples.

GO TO:
CHAPTER 4A. Pointers
CHAPTER 4B. Strings
xx Roadmap to the Syllabus

Module 4: Enumerated, Structure, and Union Types—The Type Definition (typedef), Enumerated types,
Structures—Declaration, initialization, accessing structures, operations on structures, Complex structures,
structures and functions, Passing structures through pointers, self referential structures, unions, bit fields,
C programming examples, command-line arguments,
Input and Output—Concept of a file, streams, text files and binary files, Differences between text and
binary files, State of a file, Opening and Closing files, file input 1 output functions (standard library
input 1 output functions for files), file status functions (error handling), Positioning functions, C program
examples.

GO TO:
CHAPTER 5. Structures and Unions
CHAPTER 6. File Management in C

Module 5: Searching and Sorting—Sorting-selection sort, bubble sort, Searching-linear and binary
search methods.
Lists- Linear list—singly linked list implementation, insertion, deletion and searching operations on
linear list, StacksPush and Pop Operations, Queues—Enqueue and Dequeue operations.

GO TO:
CHAPTER 7. Sorting and Searching Techniques
CHAPTER 8. Data Structures
UNIT

1 Introduction to
Computers

1.1 INTRODUCTION
The term computer is derived from the word INPUT OUTPUT
compute. A computer is an electronic device Data PROCESS Information
that takes data and instructions as an input from
the user, processes data, and provides useful
information known as output. This cycle of Instructions
operation of a computer is known as the input–
Fig. 1.1 Input–process–output concept
process–output cycle and is shown in Fig. 1.1
The electronic device is known as hardware and
the set of instructions is known as software.
A computer consists of various components that function as an integrated system to perform computational
tasks. These components include the following:
• Central Processing Unit (CPU) It is the brain of the computer that is responsible for controlling
and executing program instructions.
• Monitor It is a display screen, which shows information in visual form.
• Keyboard and Mouse These are the peripheral devices used by the computer for receiving inputs
from the user.
Figure 1.2 shows the various components of a computer.
The unique capabilities and characteristics of a computer have made it very popular among its various
users, including engineers, managers, accountants, teachers, students, etc.
Some of the key characteristics of a modern digital computer include, among others the following:
• Speed The computer is a fast electronic device that can solve large and complex problems in few
seconds. The speed of a computer generally depends upon its hardware configuration.
• Storage capacity A computer can store huge amounts of data in many different formats. The storage
area of a computer system is generally divided into two categories, main memory and secondary
storage.
1.2 Computer Programming

Monitor
CPU

Keyboard

Mouse

Fig. 1.2 The components of a computer


• Accuracy A computer carries out calculations with great accuracy. The accuracy achieved by a
computer depends upon its hardware configuration and the specified instructions.
• Reliability A computer produces results with no error. Most of the computer-generated errors are
in actuality human errors that are instigated by the user itself. Therefore, computers are regarded as
quite trustworthy machines.
• Versatility Computers are versatile machines. They can perform varied tasks and can be used for
many different purposes.
• Diligence Computers can perform repetitive calculations any number of times with the same level
of accuracy.
These capabilities of computers have enabled us to use them for a variety of tasks. Application areas may
broadly be classified into the following major categories.
1. Data processing (commercial use)
2. Numerical computing (scientific use)
3. Text (word) processing (office and educational use)
4. Message communication (e-mail)
5. Image processing (animation and industrial use)
6. Voice recognition (multimedia)

1.2 COMPUTER SYSTEMS


A computer system comprises of hardware and software components. Hardware refers to the physical
parts of the computer system and software is the set of instructions or programs that are necessary for the
functioning of a computer to perform certain tasks. Hardware includes the following components:
• Input devices They are used for accepting the data on which the operations are to be performed.
The examples of input devices are keyboard, mouse and track ball.
• Processor Also known as CPU, it is used to perform the calculations and information processing on
the data that is entered through the input device.
• Output devices They are used for providing the output of a program that is obtained after performing
the operations specified in a program. The examples of output devices are monitor and printer.
• Memory It is used for storing the input data as well as the output of a program that is obtained
after performing the operations specified in a program. Memory can be primary memory as well
Introduction to Computers 1.3

as secondary memory. Primary memory includes Random Access Memory (RAM) and secondary
memory includes hard disks and floppy disks.
Software supports the functioning of a computer system internally and cannot be seen. It is stored on
secondary memory and can be an application software as well as system software. The application software
is used to perform a specific task according to requirements and the system software is mandatory for running
application software. The examples of application software include Excel and MS Word and the examples of
system software include operating system and networking system.
All the hardware components interact with each other as well as with the software. Similarly, the different
types of software interact with each other and with the hardware components. The interaction between various
hardware components is illustrated in Fig. 1.3.
1.2.1 Input Devices
Input devices can be connected to the computer system using cables. The most commonly used input devices
among others are:
• Keyboard
• Mouse
• Scanner

Magnetic Magnetic
Tape Disk

EXTERNAL STORAGE UNITS

Input Input Memory Output Output


Media Unit Unit Unit Media

Arithmetic
Unit

Control
Unit

CPU
Data and results flow
Control Instructions to units
Instructions to control unit

Fig. 1.3 Interaction among hardware components

Keyboard
A standard keyboard includes alphanumeric keys, function keys, modifier keys, cursor movement keys,
spacebar, escape key, numeric keypad, and some special keys, such as Page Up, Page Down, Home, Insert,
Delete and End. The alphanumeric keys include the number keys and the alphabet keys. The function keys
are the keys that help perform a specific task such as searching a file or refreshing a Web page. The modifier
1.4 Computer Programming

keys such as Shift and Control keys modify the casing style of a character or symbol. The cursor movement
keys include up, down, left and right keys and are used to modify the direction of the cursor on the screen.
The spacebar key shifts the cursor to the right by one position. The numeric keypad uses separate keypads for
numbers and mathematical operators. A keyboard is show in Fig. 1.4.
Function Keys
(F1 to F12)
Escape Key
Special Keys

Numeric Keypad

Modifier Keys

Alphanumeric Spacebar Key Cursor Movement


Keys Keys

Fig. 1.4 Keyboard

Mouse
The mouse allows the user to select elements on the screen, such Wheel
as tools, icons, and buttons, by pointing and clicking them. We can Right Button
also use a mouse to draw and paint on the screen of the computer Left Button
system. The mouse is also known as a pointing device because it
helps change the position of the pointer or cursor on the screen.
The mouse consists of two buttons, a wheel at the top and a
ball at the bottom of the mouse. When the ball moves, the cursor
on the screen moves in the direction in which the ball rotates. The Fig. 1.5 Mouse
left button of the mouse is used to select an element and the right
button, when clicked, displays the special options such as open and explore and shortcut menus. The wheel
is used to scroll down in a document or a Web page. A mouse is shown in Fig. 1.5.

Scanner
A scanner is an input device that converts documents and images as the
digitized images understandable by the computer system. The digitized
images can be produced as black and white images, gray images, or
colored images. In case of colored images, an image is considered as a
collection of dots with each dot representing a combination of red, green,
and blue colors, varying in proportions. The proportions of red, green, and
blue colors assigned to a dot are together called as color description. The
scanner uses the color description of the dots to produce a digitized image.
Fig. 1.6 shows a scanner.
There are the following types of scanners that can be used to produce Fig. 1.6 Scanner
digitized images:
• Flatbed scanner It contains a scanner head that moves across a page from top to bottom to read the
page and converts the image or text available on the page in digital form. The flatbed scanner is used
to scan graphics, oversized documents, and pages from books.
Introduction to Computers 1.5

• Drum scanner In this type of scanner, a fixed scanner head is used and the image to be scanned is
moved across the head. The drum scanners are used for scanning prepress materials.
• Slide scanner It is a scanner that can scan photographic slides directly to produce files understandable
by the computer.
• Handheld scanner It is a scanner that is moved by the end user across the page to be scanned. This
type of scanner is inexpensive and small in size.

1.2.2 CPU
The CPU consists of Control Unit (CU) and ALU. CU stores the instruction set, which specifies the operations
to be performed by the computer. CU transfers the data and the instructions to the ALU for an arithmetic
operation. ALU performs arithmetical or logical operations on the data received. The CPU registers store the
data to be processed by the CPU and the processed data also. Apart from CU and ALU, CPU seeks help from
the following hardware devices to process the data:

Motherboard
It refers to a device used for connecting the CPU with the input and output devices. The components on the
motherboard are connected to all parts of a computer and are kept insulated from each other. Some of the
components of a motherboard are:
• Buses Electrical pathways that transfer data and instructions among different parts of the computer.
For example, the data bus is an electrical pathway that transfers data among the microprocessor,
memory and input/output devices connected to the computer. The address bus is connected among
the microprocessor, RAM and Read Only Memory (ROM), to transfer addresses of RAM and ROM
locations that is to be accessed by the microprocessor.
• System clock It is a clock used for synchronizing the activities performed by the computer. The
electrical signals that are passed inside a computer are timed, based on the tick of the clock. As a
result, the faster the system clock, the faster is the processing speed of the computer.
• Microprocessor CPU component that performs the processing and controls the activities performed
by the different parts of the computer. The microprocessor is plugged to the CPU socket placed on the
motherboard.
• ROM Chip that contains the permanent memory of the computer that stores information, which
cannot be modified by the end user.

Random Access Memory (RAM)


It refers to primary memory of a computer that stores information and programs, until the computer is used.
RAM is available as a chip that can be connected to the RAM slots in the motherboard.

Video Card/Sound card


The video card is an interface between the monitor and the CPU. Video cards also include their own RAM
and microprocessors that are used for speeding up the processing and display of a graphic. These video cards
are placed on the expansion slots, as these slots allow us to connect the high-speed graphic display cards to
the motherboard. A sound card is a circuit board placed on the motherboard and is used to enhance the sound
capabilities of a computer. The sound cards are plugged to the Peripheral Component Interconnect (PCI)
slots. The PCI slots also enable the connection of networks interface card, modem cards and video cards, to
the motherboard.
1.6 Computer Programming

Fig. 1.7 A motherboard

1.2.3 Output Devices


The data, processed by the CPU, is made available to the end user by the output devices. The most commonly
used output devices are:
• Monitor
• Printer
• Speaker
• Plotter

Monitor
A monitor is the most commonly used output device that produces visual
displays generated by the computer. The monitor, also known as a screen, is
connected as an external device using cables or connected either as a part of the
CPU case. The monitor connected using cables, is connected to the video card
placed on the expansion slot of the motherboard. The display device is used for
visual presentation of textual and graphical information.
The monitors can be classified as cathode ray tube (CRT) monitors or liquid
crystal display (LCD) monitors. The CRT monitors are large, occupy more space
in the computer, whereas LCD monitors are thin, light weighted, and occupy Fig. 1.8 Monitor
lesser space. Both the monitors are available as monochrome, gray scale and
color models. However, the quality of the visual display produced by the CRT is
better than that produced by the LCD.
A monitor can be characterized by its monitor size and resolution. The monitor size is the length of
the screen that is measured diagonally. The resolution of the screen is expressed as the number of picture
Introduction to Computers 1.7

elements or pixels of the screen. The resolution of the monitor is also called the dot pitch. The monitor with
a higher resolution produces a clearer image.

Printer
The printer is an output device that is used to produce a hard copy of the
electronic text displayed on the screen, in the form of paper sheets that can be
used by the end user. The printer is an external device that is connected to the
computer system using cables. The computer needs to convert the document
that is to be printed to data that is understandable by the printer. The printer
driver software or the print driver software is used to convert a document to
a form understandable by the computer. When the computer components are
upgraded, the upgraded printer driver software needs to be installed on the
computer.
Fig. 1.9 Printer
The performance of a printer is measured in terms of dots per inch (DPI)
and pages per minute (PPM) produced by the printer. The greater the DPI
parameter of a printer, the better is the quality of the output generated by it. The higher PPM represents
higher efficiency of the printer. Printers can be classified based on the technology they use to print the text
and images:
• Dot matrix printers Dot matrix printers are impact printers that use perforated sheet to print the
text. The process to print a text involves striking a pin against a ribbon to produce its impression on
the paper.
• Inkjet printers Inkjet printers are slower than dot matrix printers and are used to generate high
quality photographic prints. Inkjet printers are not impact printers. The ink cartridges are attached to
the printer head that moves horizontally, from left to right.
• Laser printers The laser printer may or may not be connected to a computer, to generate an output.
These printers consist of a microprocessor, ROM and RAM, which can be used to store the textual
information. The printer uses a cylindrical drum, a toner and the laser beam.

Speaker
The speaker is an electromechanical transducer that converts an electrical
signal into sound. They are attached to a computer as output devices, to
provide audio output, such as warning sounds and Internet audios. We can
have built-in speakers or attached speakers in a computer to warn end users
with error audio messages and alerts. The audio drivers need to be installed in
the computer to produce the audio output. The sound card being used in the
computer system decides the quality of audio that we listen using music CDs
or over the Internet. The computer speakers vary widely in terms of quality
and price. The sophisticated computer speakers may have a subwoofer unit, to
enhance bass output. Fig. 1.10 Speakers

Plotter
The plotter is another commonly used output device that is connected to a computer to print large documents,
such as engineering or constructional drawings. Plotters use multiple ink pens or inkjets with color cartridges
1.8 Computer Programming

for printing. A computer transmits binary signals to all the print heads of the plotter. Each binary signal
contains the coordinates of where a print head needs to be positioned for printing. Plotters are classified on
the basis of their performance, as follows:
• Drum plotter They are used to draw perfect circles and other graphic images. They use a drawing
arm to draw the image. The drum plotter moves the paper back and forth through a roller and the
drawing arm moves across the paper.
• Flat-bed plotter A flat bed plotter has a flat drawing surface and the two drawing arms that move
across the paper sheet, drawing an image. The plotter has a low speed of printing and is large in
size.
• Inkjet plotter Spray nozzles are used to generate images by spraying droplets of ink onto the paper.
However, the spray nozzles can get clogged and require regular cleaning, thus resulting in a high
maintenance cost.
• Electrostatic plotter As compared to other plotters, an electrostatic plotter produces quality print
with highest speed. It uses charged electric wires and special dielectric paper for drawing.

Control
Buttons

Plotted
Paper

Fig. 1.11 An ink-jet plotter.

1.2.4 Memory
The memory unit of a computer is used to store data, instructions for processing data, intermediate results
of processing and the final processed information. The memory units of a computer are classified as primary
memory and secondary memory. Figure 1.12 shows the memory categorization in a computer system.
Introduction to Computers 1.9

Fig. 1.12 Categorization of Memory Devices

Primary Memory
The primary memory is available in the computer as a built-in unit of the computer. The primary memory is
represented as a set of locations with each location occupying 8 bits. Each bit in the memory is identified by
a unique address. The data is stored in the machine-understandable binary form in these memory locations.
The commonly used primary memories are:
• ROM ROM represents Read Only Memory that stores data and instructions, even when the
computer is turned off. It is the permanent memory of the computer where the contents cannot be
modified by an end user. ROM is a chip that is inserted into the motherboard. It is generally used to
store the Basic Input/Output system (BIOS), which performs the Power On Self Test (POST).
• RAM RAM is the read/write memory unit in
which the information is retained only as long
as there is a regular power supply. When the
power supply is interrupted or switched off, the
information stored in the RAM is lost. RAM is a
volatile memory that temporarily stores data and
applications as long as they are in use. When the
Integrated
use of data or the application is over, the content in chips
RAM is erased.
Fig. 1.13 RAM
• Cache memory Cache memory is used to store
the data and the related application that was last processed by the CPU. When the processor performs
processing, it first searches the cache memory and then the RAM, for an instruction. The cache
memory is always placed between CPU and the main memory of the computer system.
1.10 Computer Programming

Table 1.1 depicts some of the key differences between RAM and ROM:

TABLE 1.1

RAM ROM
It is a read/write memory It is a read only memory
It is volatile storage device It is a permanent storage device
Data is erased as soon as power supply is Data remains stored even after power supply
turned off has been turned off
It is used as the main memory of a computer It is used to store Basic input output system
system (BIOS).

Secondary Memory
Secondary memory represents the external storage devices that are connected to the computer. They provide
a non-volatile memory source used to store information that is not in use currently. A storage device is either
located in the CPU casing of the computer or is connected externally to the computer. The secondary storage
devices can be classified as:
• Magnetic storage device The magnetic storage
devices store information that can be read, erased
and rewritten a number of times. These include
floppy disk, hard disk and magnetic tapes.
• Optical storage device The optical storage devices
are secondary storage devices that use laser beams
to read the stored data. These include CD-ROM,
rewritable compact disk (CD-RW), and digital video
disks with read only memory (DVD-ROM). Fig. 1.14 Magnetic tape

Tracks
Sectors

Fig. 1.15 Magnetic disk


Introduction to Computers 1.11

Incident laser beam


Reflected laser beam

Fig. 1.16 Optical Disk

Reflective aluminium layer Magneto optical flim

Protective coating

Dielectric
layers

Laser beams

Lens
Substrate layer

Fig. 1.17 Magneto-optical disk


• Magneto-optical storage device The magneto-optical devices
are generally used to store information, such as large programs,
files and backup data. The end user can modify the information
stored in magneto-optical storage devices multiple times. These
devices provide higher storage capacity as they use laser beams
and magnets for reading and writing data to the device. Examples
of magneto-optical devices include Sony MiniDisc, Maxoptix T5-
2600, etc.
• Universal serial bus (USB) drive USB drive or commonly
known as pen drive is a removable storage device that is interfaced
on the USB port of a computer system. It is pretty fast and compact Fig. 1.18 USB drive
1.12 Computer Programming

in comparison to other storage devices like CD and floppy disk. One of the most important advantages
of a USB drive is that it is larger in capacity as compared to other removable storage devices. Off late,
it has become very popular amongst computer users.

1.3 PROGRAMMING LANGUAGES


The operations of a computer are controlled by a set of instructions (called a computer program). These
instructions are written to tell the computer:
1. what operation to perform
2. where to locate data
3. how to present results
4. when to make certain decisions
The communication between two parties, whether they are machines or human beings, always needs a
common language or terminology. The language used in the communication of computer instructions is
known as the programming language. The computer has its own language and any communication with the
computer must be in its language or translated into this language.
Three levels of programming languages are available. They are:
1. machine languages (low level languages)
2. assembly (or symbolic) languages
3. procedure-oriented languages (high level languages)

1.3.1 Machine Language


As computers are made of two-state electronic devices they can understand only pulse and no-pulse
(or ‘1’ and ‘0’) conditions. Therefore, all instructions and data should be written using binary codes
1 and 0. The binary code is called the machine code or machine language.
Computers do not understand English, Hindi or Tamil. They respond only to machine language. Added to
this, computers are not identical in design, therefore, each computer has its own machine language. (However,
the script 1 and 0, is the same for all computers). This poses two problems for the user.
First, it is difficult to understand and remember the various combinations of 1’s and 0’s representing
numerous data and instructions. Also, writing error-free instructions is a slow process.
Secondly, since every machine has its own machine language, the user cannot communicate with other
computers (If he does not know its language). Imagine a Tamilian making his first trip to Delhi. He would
face enormous obstacles as the language barrier would prevent him from communicating.
Machine languages are usually referred to as the first generation languages.

1.3.2 Assembly Language


The Assembly language, introduced in 1950s, reduced programming complexity and provided some
standardization to build an application. The assembly language, also referred to as the second-generation
programming language, is also a low-level language. In an assembly language, the 0s and 1s of machine
language are replaced with abbreviations or mnemonic code.
The main advantages of an assembly language over a machine language are:
• As we can locate and identify syntax errors in assembly language, it is easy to debug it.
• It is easier to develop a computer application using assembly language in comparison to machine
language.
• Assembly language operates very efficiently.
Introduction to Computers 1.13

An assembly language program consists of a series of instructions and mnemonics that correspond to a
stream of executable instructions. An assembly language instruction consists of a mnemonic code followed
by zero or more operands. The mnemonic code is called the operation code or opcode, which specifies the
operation to be performed on the given arguments. Consider the following machine code:
10110000 01100001
Its equivalent assembly language representation is:
mov al, 061h
In the above instruction, the opcode “move” is used to move the hexadecimal value 61 into the processor
register named ‘al’. The following program shows the assembly language instructions to subtract two
numbers:
ORG 500 /Origin of program is location 500
LDA SUB /Load subtrahend to AC
CMA /Complement AC
INC /Increment AC
ADD MIN /Add minuend to AC
STA DIF /Store difference
HLT /Halt computer
MIN, DEC 56 /Minuend
SUB, DEC -2 /Subtrahend
DIF, HEX 0 /Difference stored here
END /End of symbolic program
It should be noted that during execution, the assembly language program is converted into the machine
code with the help of an assembler. The simple assembly language statements had one-to-one correspondence
with the machine language statements. This one-to-one correspondence still generated complex programs.
Then, macroinstructions were devised so that multiple machine language statements could be represented
using a single assembly language instruction. Even today programmers prefer to use an assembly language
for performing certain tasks such as:
• To initialize and test the system hardware prior to booting the operating system. This assembly
language code is stored in ROM
• To write patches for disassembling viruses, in anti-virus product development companies
• To attain extreme optimization, for example, in an inner loop in a processor-intensive algorithm
• For direct interaction with the hardware
• In extremely high-security situations where complete control over the environment is required
• To maximize the use of limited resources, in a system with severe resource constraints

1.3.3 High-Level Languages


High level languages further simplified programming tasks by reducing the number of computer operation
details that had to be specified. High level languages like COBOL, Pascal, FORTRAN, and C are more
abstract, easier to use, and more portable across platforms, as compared to low-level programming languages.
Instead of dealing with registers, memory addresses and call stacks, a programmer can concentrate more on
the logic to solve the problem with help of variables, arrays or Boolean expressions. For example, consider
the following assembly language code:
LOAD A
ADD B
1.14 Computer Programming

STORE C
Using FORTRAN, the above code can be represented as:
C=A+B
The above high-level language code is executed by translating it into the corresponding machine language
code with the help of a compiler or interpreter.
High-level languages can be classified into the following three categories:
• Procedure-oriented languages (third generation)
• Problem-oriented languages (fourth generation)
• Natural languages (fifth generation)

1.3.4 Procedure-oriented Languages


High-level languages designed to solve general-purpose problems are called procedural languages or third-
generation languages. These include BASIC, COBOL, FORTRAN, C, C++, and JAVA, which are designed
to express the logic and procedure of a problem. Although, the syntax of these programming languages
is different, they use English-like commands that are easy to follow. Another major advantage of third-
generation languages is that they are portable. We can use the compiler (or interpreter) on any computer and
create the object code. The following program represents the source code in the C language:
if( n>10)
{
do
{
n++;
}while ( n<50);
}
The third generation programming languages are considered as domain-specific programming languages
because they are designed to develop software applications for a specific field. For example, the third
generation programming language, COBOL, was designed to solve a large number of problems specific to
the business field.

1.3.5 Problem-oriented Languages


Problem-oriented languages are used to solve specific problems and are known as the fourth-generation
languages. These include query Languages, Report Generators and Application Generators which have simple,
English-like syntax rules. Fourth-generation languages (4 GLs) have reduced programming efforts and overall
cost of software development. These languages use either a visual environment or a text environment for
program development similar to that of third-generation languages. A single statement in a fourth-generation
language can perform the same task as multiple lines of a third-generation language. Further, the programmer
just needs to drag and drop from the toolbar, to create various items like buttons, text boxes, labels, etc. Also,
the programmer can quickly create the prototype of the software application.
These languages are typically used in the WYSIWYG (What You See Is What You Get) environment
to facilitate faster and convenient application development. Visual Studio is one such environment that
encompasses a number of programming tools as well multiple programming language support to ensure
flexibility to the programmer during application development.

1.3.6 Natural Languages


Natural languages are designed to make a computer to behave like an expert and solve problems. The
programmer just needs to specify the problem and the constraints for problem-solving. Natural languages
Introduction to Computers 1.15

such as LISP and PROLOG are mainly used to develop artificial intelligence and expert systems. These
languages are widely known as fifth generation languages.
The programming languages of this generation mainly focus on constraint programming, which is
somewhat similar to declarative programming. It is a programming paradigm in which the programmer only
needs to specify the solution to be found within the constraints rather than specifying the method of finding
the desired solution
The programming languages of this generation allow the users to communicate with the computer system
in a simple and an easy manner. Programmers can use normal English words while interacting with the
computer system.

1.4 PROGRAMMING ENVIRONMENT


A programming environment comprises all those components that facilitate the development of a program.
These components are largely divided under two categories— programming tools and Application Programming
Interfaces (APIs). They are regarded as the building blocks of any programming environment.
An API can be defined as a collection of data structures, classes, protocols, and pre-defined functions
stored in the form of libraries. These libraries are included in the software packages of the programming
languages like C, C++, etc. An API makes the development task easier for the programmers, as in-built API
components are used again and again, ensuring reusability.
The software application which is used for the development, maintenance and debugging of a software
program is known as programming tool. A good programming tool ensures that the programming activities
are performed in an efficient manner. The following are some of the main categories of programming tools:
• Integrated Development Environment (IDE) It is the most commonly used tool that offers an
integrated environment to the programmers for software development. It contains almost all the
components for software development such as compiler, editor, debugger, etc.
• Debugging tool It is a specialized tool that helps the programmer to detect and remove bugs or
errors from a program.
• Memory usage tool As the name suggests, memory usage tool helps the programmer to manage the
memory resources in an efficient manner.

1.5 CREATING AND RUNNING PROGRAMS


A programmer should adopt standard methodologies and approaches to program development. Software or
program-development life cycle is one such standard methodology that is applicable to all types of program
development scenarios. It comprises of a number of interlinked phases with each phase serving a definite
purpose. We will study the program development life cycle in more detail in the next section.

1.5.1 Structured Programming


Another important program development approach is structured programming, which is a subset of one of the
key programming paradigms, i.e., procedural programming.
It helps in making a program easily understandable and debuggable. A program that is not based on the
structured programming approach is very difficult to maintain, debug and understand.
Structured programming approach mainly focuses on the order of execution of the statements within a
program. It suggests the use of sequential execution of statements in a program. Thus, structured programming
approach suggests the use of mainly three types of control structures—sequential, repetitive and selective.
1.16 Computer Programming

Further, it suggests avoiding the use of goto, break and continue statements in a program as all these are
unconditional branch statements.

1.5.2 System Development Tools


The successful development and execution of programs requires the usage of a number of tools. Some of
these typical system development tools are
• Language translators
• Linkers
• Debuggers
• Editors

Language Translators
• Assembler An assembler is a computer program that translates assembly language statements into
machine language codes. The assembler takes each of the assembly language statements from the source
code and generates a corresponding bit stream using 0’s and 1’s. The output of the assembler in the form of
sequence of 0’s and 1’s is called object code or machine code. This machine code is finally executed to obtain
the results.
A modern assembler translates the assembly instruction mnemonics into opcodes and resolves symbolic
names for memory locations and other entities to create the object code. Several sophisticated assemblers
provide additional facilities that control the assembly process, facilitate program development, and aid
debugging. The modern assemblers like Sun SPARC and MIPS based on RISC architectures, optimize
instruction scheduling to attain efficient utilization of CPU. The modern assemblers generally include a
macro facility and are called macro assemblers.
Assemblers can be classified as single-pass assemblers and two-pass assemblers. The single-pass
assembler was the first assembler that processed the source code once to replace the mnemonics with the
binary code. The single-pass assembler was unable to support advanced source-code optimization. As a
result, the two-pass assembler was developed that read the program twice. During the first pass, all the
variables and labels are read and placed into the symbol table. On the second pass, the label gaps are filled from
the table by replacing the label name with the address. This helps to attain higher optimization of the source
code. The translation process of an assembler consists of the following tasks:
• Replacing symbolic addresses like LOOP, by numeric addresses
• Replacing symbolic operation code by machine operation codes
• Reserving storage for the instructions and data
• Translating constants into their machine representation

• Compiler The compiler is a computer program that translates the source code written in a high-level
language into the corresponding object code of the low-level language. This translation process is called
compilation. The entire high-level program is converted into the executable machine code file. A program
that translates from a low-level language to a high-level one is a decompiler. Compiled languages include
COBOL, FORTRAN, C, C++, etc.
In 1952, Grace Hopper wrote the first compiler for the A-0 programming language. In 1957, John Backus
at IBM introduced the first complete compiler. With the increasing complexity of computer architectures
and expanding functionality supported by newer programming languages, compilers have become more
Introduction to Computers 1.17

and more complex. Though early compilers were written in assembly languages, nowadays it has become
common practice to implement a compiler in the language it compiles. Compilers are also classified as single-
pass compilers and multi-pass compilers. Though single-pass compilers are generally faster than multi-pass
compilers, for sophisticated optimization, multi-pass assemblers are required to generate high-quality code.

• Interpreter The interpreter is a translation program that converts each high-level program statement
into the corresponding machine code. This translation process is carried out just before the program statement
is executed. Instead of the entire program, one statement at a time is translated and executed immediately.
The commonly used interpreted language are BASIC and PERL. Although, interpreters are easier to create as
compared to compilers, the compiled languages can be executed more efficiently and are faster.

Linkers
Most of the high-level languages allow the developer to develop a large program containing multiple modules.
Linker arranges the object code of all the modules that have been generated by the language translator into
a single program. The execution unit of the computer system is incapable of linking all the modules at
the execution time and therefore, linker is regarded as one of the important software because of its ability
to combine all the modules into a single program. Linker assembles the various objects generated by the
compiler in such a manner that all the objects are accepted as a single program during execution. Linker
also includes the links of various objects, which are defined in the runtime libraries. In many cases, linker
inserts the symbolic address of the objects in place of their real address. Figure 1.19 illustrates the working
of a linker.

Debuggers
Debugger is the software that is used to detect the errors and bugs present in the programs. The debugger
locates the position of the errors in the program code with the help of what is known as the Instruction Set

Language Object Code


Module 1
Translator
Source Code

Language Object Code


Module 2
Translator
Source Code

. Executable
. Linker Program
.
Language Object Code
Module n
Translator
Source Code

Routine
Libraries

Fig. 1.19 Working of a linker


1.18 Computer Programming

Simulator (ISS) technique. ISS is capable of stopping the execution of a program at the point where an
erroneous statement is encountered.
Debugger is divided into two types, namely machine-level debugger and symbolic debugger. The machine-
level debugger debugs the object code of the program and shows all the lines where bugs are detected. On
the other hand, the symbolic debugger debugs the original code, i.e., the high-level language code of the
program. It shows the position of the bug in the original code of the program developed by the programmer.
While debugging a program, the debugger performs a number of functions other than debugging, such as
inserting breakpoints in the original code, tracking the value of specific variables, etc. In order to debug the
program, a debugger helps perform the following tasks:
• Step-by-step execution of a program
• Back tracking for checking the previous steps
• Stopping the execution of the program until the errors are corrected
Editors
Editor is a special program that allows the user to work with text in a computer system. It is used for the
documentation purposes and enables us to edit the information present in an existing document or a file. The
editor enables us to perform various editing operations such as copy, cut and paste while editing the text. On
the basis of the content edited by the editors, they are divided into the following categories:
• Text editor It is used to edit plain text. An operating system always includes a text editor for
updating the configuration files.
• Digital audio editor It is used to edit the information related to the audio components of a
multimedia application. These editors are used in audio applications where editing the music and the
sound signals is necessary.
• Graphics editor It is used to edit the information related to the graphical objects. These editors
are generally used in the multimedia applications where the user is working with multiple animation
objects.
• Binary file editor It is used to edit the digital data or the binary data, i.e., data having strings of 0s
and 1s.
• HTML editor It is used to edit the information included in the Web pages.
• Source code editor It is used to edit the source code of a program written in a programming
language such as C, C++ and Java.

1.5.3 Developing a Program


Developing a program refers to the process of writing the source code for the required application by following
the syntax and the semantics of the chosen programming language. Syntax and semantics are the set of rules
that a programmer needs to adhere while developing a program.
Before actually developing a program, the aim and the logic of the program should be very clear to the
programmer. Therefore, the first stage in the development of a program is to carry out a detailed study of
the program objectives. The objectives make the programmer aware of the purpose for which the program
is being developed. After ascertaining the program objectives, the programmer needs to list down the set of
steps to be followed for program development. This set of program development steps is called algorithm.
The programmer may also use a graphical model known as flowchart to represent the steps defined in the
program algorithm.
After the logic of the program has been developed either by an algorithm or a flowchart, the next step
is to choose a programming language for actual development of the program code. There are a number of
Introduction to Computers 1.19

factors that should be taken into consideration while selecting the target programming language, such as
performance and efficiency of the programming language, programmer’s prior experience with the language,
etc.
A programming language is typically bundled together with an IDE containing the necessary tools for
developing, editing, running and debugging a computer program. For instance, Turbo C is provided with a
strong and powerful IDE to develop, compile, debug and execute the programs.
Figure 1.20 shows the IDE of C language.

Fig. 1.20 The IDE of C Language.


Suppose we are required to develop a program for calculating the percentage of marks of two subjects
for student and display the result. The first step in the development of a program for this problem is the
preparation of an algorithm, as shown below:

Step 1 – Input the marks for first subject. (mark1)


Step 2 – Input the marks for second subject. (mark2)
Step 3 – Calculate the percentage.
percentage = (mark1 + mark2)/200*100
Step 4 – If percentage > 40
Step 5 – Display Pass
Step 6 – Else
Step 7 – Display Fail

Figure 1.21 shows the flowchart for the above algorithm.


1.20 Computer Programming

Start

Input Marks1, Marks2

Input Marks1, Marks2

Perc = (Total 2000)* 100

Is True Display ‘‘Pass’’


Perc > 40 ?

False
Display ‘‘Fail’’

End

Fig. 1.21 Flowchart for calculating the percentage of marks and displaying the result.
After developing the algorithm and flowchart, the actual development of the program can be started in the
source code editor of C language. The following code shows the C language program for calculating the
percentage of marks in two different subjects for a student.

#include<stdio.h>
#include<conio.h>
void main()
{
float mark1,mark2;
float percentage;
clrscr();
printf("\n Enter marks of first subject:");
scanf("\n %f", &mark1);
printf("\n Enter marks of second subject:");
scanf("\n %f", &mark2);
percentage =((mark1+mark2)/200)*100;
if(percentage>40)
Introduction to Computers 1.21

printf("\n The student is passed”);


else
printf("\n The student is failed”);
getch();
}

Figure 1.22 shows the program code in the source code editor of C language.

Fig. 1.22 Developing a program in the source code editor of C language.

1.5.4 Running a Program


After developing the program code, the next step is to compile the program. Program compilation helps
identify any syntactical errors in the program code. If there are no syntax errors in the source code, then the
compiler generates the target object code. It is the machine language code that the processor of the computer
system can understand and execute.
Once the corresponding object code or the executable file is built by the compiler, the program can be run
in order to check the logical correctness of the program and generate the desired output. The logical errors
also called semantic errors might cause the program to generate undesired results. Programming languages
provide various mechanisms such as exception handling for handling these logical errors. If the output
generated by the program corresponding to the given inputs matches with the desired result, then the purpose
of developing the program is served. Otherwise, the logic of the program should be checked again to obtain
the correct solution for the given problem.
Figure 1.23 shows the output of the program developed in C language.
1.22 Computer Programming

Fig. 1.23 Running a program.


The above figure shows the output generated by running the C program. We can run a program in C by either
selecting Run Æ Run or by pressing the Alt and F9 keys simultaneously.

1.6 SOFTWARE DEVELOPMENT METHOD


The entire process of software development and implementation involves a series of steps. Each successive
step is dependent on the outcome of the previous step. Thus, the team of software designers, developers and
operators are required to interact with each other at each stage of software development so as to ensure that
the end product is as per the client’s requirements. Figure 1.24 shows the various software development steps:

Analysing the
requirements

Feasibility
Analysis

Creating
the Design

Developing
code

Testing the
software

Deploying
the software

Maintaining
the software

Fig. 1.24 Software development steps


Introduction to Computers 1.23

1.6.1 Analysing the Requirements


In this step, the requirements related to the software, which is to be developed, are understood. Analysing
the requirements or requirement analysis is an important step in the process of developing a software. If the
requirements of the user are not properly understood, then the software is bound to fall short of the end user’s
expectations. Thus, requirement analysis is always the first step towards development of a software.
Software is abstract in nature; as a result, the users may not be able to provide the complete set of
requirements pertaining to the desired software during the requirement analysis stage. Thus, there should be
continuous interaction between the software development team and the end users. Moreover, the software
development team also needs to take into account the fact that the requirements of the users may keep changing
during the development process. Thus, proper analysis of user requirements is quite essential for developing
the software within a given timeframe. It will not only help in controlling the software development cost but
will also lead to faster and accurate development of a software.
The task of requirement analysis is typically performed by a business analyst. The person is a professional
in this field who understands the requirements of the novice end user, and documents and shares it with the
development team.

1.6.2 Feasibility Analysis


In this step, the feasibility of developing the software in terms of resources and cost is ascertained. In order
to determine the feasibility of software development, the existing system of the user is analysed properly.
Apart from studying the existing system, this step involves identifying the need of automation in the existing
system. The analysis done in this step is documented in a standard document called feasibility report, which
contains the observations and recommendations related to the task of software development. Some of the
important activities performed during the feasibility analysis stage are as follows:
• Determining development alternatives This activity involves searching for the different
alternatives that are available for the development of software. There are mainly four alternatives
available for the development of a software. The first alternative is to allow the existing system
to continue without developing a new software for automation. The second alternative can be to
develop the new software using specific programming languages such as Java, C++, Visual Basic etc.
The third alternative is to develop the software using the architectural technologies such as Java 2
Enterprise Edition (J2EE) and mainframe based with thin clients. The fourth development alternative
is to buy an already developed software along with its source code from the market and customise it
according to the client’s requirements.
• Analysing economic feasibility This activity involves determining whether the development of
a new software will be financially beneficial or not. This type of feasibility analysis is performed
to determine the overall profit that can be earned from the development and implementation of
the software. This feasibility analysis activity involves evaluating all the alternatives available for
development and selecting the one which is most economical.
• Assessing technical feasibility The technical feasibility assessment involves analysing various
factors such as performance of the technologies, ease of installation, ease of expansion or reduction
in size, interoperability with other technologies, etc. The technical feasibility activity typically
involves the study of the nature of technology as to how easily it can be learnt and the level of
training required to understand the technology. This type of feasibility assessment greatly helps in
selecting the appropriate technologies to be used for developing the software. The selection should
be made after evaluating the requirement specification of the software. In addition, the advantages
and disadvantages of each identified technology must also be evaluated during technical feasibility
assessment.
1.24 Computer Programming

• Analysing operational feasibility Operational feasibility assessment involves studying the software
on operational and maintenance fronts. The operational feasibility of any software is done on the basis
of several factors, such as:
– Type of tools needed for operating the software
– Skill set required for operating the software
– Documentation and other support required for operating the software

1.6.3 Creating the Design


After the feasibility analysis stage, the next step is creating the architecture and design of the new software.
This step involves developing a logical model or basic structure of the new software. For example, if the
new software is based on client–server technology then this step would involve determining and specifying
the number of tiers to be used in the client–server design. This step also involves documenting the varied
specifications pertaining to database and data structure design. The flow of the development process is mainly
illustrated in this stage using a special language known as Unified Modelling Language (UML). UML uses
pictorial representation methods for depicting the flow of data in the software. Some of the key features,
which are considered while designing a software, are:
• Extensibility The design of the software should be extensible so that it allows the addition of some
new options or modules in future. The architecture of the software should be flexible enough to not
get disturbed with the addition of new functionality.
• Modularity The software should be modular in nature so that its working and data flow can be
understood easily. Modularity also helps in parallel development of the various software modules,
which are later integrated into a single software product.
• Compatibility Software should run correctly in the existing system with an older version or
with other software. Thus, software should be compatible and work well in conjunction with other
software.
• Security Software must be able to control unauthorised access. While designing a new software, it
is ensured that there are proper security mechanisms incorporated in the product.
• Fault tolerance The software should be capable of handling exceptions or faults that may occur
during its operation. The software must have the capability to recover from failures.
• Maintainability The design of the software should be created in a simple manner with appropriate
details so that it is easy to maintain.

1.6.4 Developing Code


In this step, the code for the different modules of the new software is developed. The code for the different
modules is developed according to the design specifications of each module. The programmers in the software
development team use tools like compilers, interpreters and debuggers to perform tasks such as finding errors
in the code and converting the code into machine language for its execution. The code can be written using
programming languages such as C, C++ or Java. The choice of the programming language to be used for
developing the code is made on the basis of the type of software that is to be developed. There are certain key
points or conventions, which must be kept in mind while writing code; for instance:
• There should be proper indentation in the code.
• Proper naming conventions should be followed for naming the variables, methods and program
files.
• Proper comments should be included to ensure ease of understanding during maintenance.
Introduction to Computers 1.25

• The code for different modules of the new software must be simple so that it can be easily
understood.
• The code must be logically correct so as to minimise logical errors in the program.

1.6.5 Testing the Software


Testing is basically performed to detect the prevalence of any errors in the new software and rectify those
errors. One of the reasons for the occurrence of errors or defects in a new software is that the requirements of
the users or client were not properly understood. Another reason for the occurrence of errors is the common
mistakes committed by a programmer while developing the code. The two important activities that are
performed during testing are verification and validation. Verification is the process of checking the software
based on some pre-defined specifications, while validation involves testing the product to ascertain whether
it meets the user’s requirements. During validation, the tester inputs different values to ascertain whether the
software is generating the right output as per the original requirements. The various testing methodologies
include:
• Black box testing
• White box testing
• Gray box testing
• Nonfunctional testing
• Unit testing
• Integration testing
• System testing
• Acceptance testing

1.6.6 Deploying the Software


In this step, the newly developed and fully tested software is installed in its target environment. Software
documentation is handed over to the users and some initial data are entered in the software to make it
operational. The users are also given training on the software’s interface and its other functions.

1.6.7 Maintaining the Software


Once the software has been deployed successfully, a continuous support is provided to it for ensuring its
full-time availability. A corrupt file, a virus infection and a fatal error are some of the situations where the
maintenance personnel are asked to fix the software and bring it back to its normal functioning. Further, a
software may also be required to be modified if its environment undergoes a change. In order to successfully
maintain the software, it is required that it should have been properly documented at the time of its
development. This is because the maintenance person might not be the same who was originally involved in
the development of the software. Thus, a good code documentation serves vital for the maintenance person
to fix the software.

1.7 APPLYING SOFTWARE DEVELOPMENT METHOD


To understand how software development method is applied, consider a simple scenario where it is required
to convert the temperature given in Fahrenheit to its corresponding Celsius value.
Exploring the Variety of Random
Documents with Different Content
Limes 0 0 04⁄5
Litchis, dried 0 0 22⁄5
Locksoy 0 0 62⁄5
53⁄5 per
Lobchocks 0 0
catty.
Lamp oil 0 0 53⁄5
Lamp wick 0 0 8
Melons 0 0 44⁄5 each.
11⁄4 per
Milk 0 0
catty.
Ditto, Macao 0 0 31⁄5
Mustard seed 0 0 62⁄5
Mushrooms,
0 2 8
pickled
Ditto, fresh 0 1 4
per
Oysters 0 3 4
pecul.
22⁄5 per
Onions, dried 0 0
catty.
Pork 0 0 71⁄7
Pig 0 0 53⁄5
Paddy 0 0 04⁄5
Pepper 0 1 04⁄5
Pheasants 0 5 4 each.
3
Partridges 0 0 9 ⁄5
Pigeons 0 0 51⁄5
Pomegranates 0 0 22⁄5
Quails 0 0 13⁄5
Rabbits 0 1 4
per
Rice 0 0 2
catty.
Ditto, red 0 0 22⁄5
Ditto, coarse 0 0 11⁄5
Ditto, Japan 0 0 8
Raisins 0 2 0
Sheep 3 6 8 each.
11⁄2 per
Snipes 0 0
catty.
Sturgeon 0 4 93⁄5
Ditto, small 0 2 44⁄5
Sugar 0 0 31⁄5
Salt 0 0 13⁄5
Saltpetre 0 2 13⁄5
Soy 0 0 13⁄5
Spices 0 16 8
62⁄5 per
Sweet-meats 0 0
catty.
Sago 0 0 31⁄5
Sallad 0 0 22⁄5
Sharks’ fins 0 2 13⁄5
Samsui soy 0 0 22⁄5
Teal 0 0 62⁄5 each.
93⁄5 per
Turtle 0 0
catty.
Tea 0 2 0
Turmeric 0 0 22⁄5
Tamarinds 0 0 8
3
Vinegar 0 0 1 ⁄5
Vermicelli 0 0 31⁄5
Wax candles 0 3 0
4
Walnuts 0 0 4 ⁄5
per
Wood 0 1 4
pecul.
per 100
Water 0 6 8
Bs .
£ s. d.
Rent of
per
Poho 400 0 0
annum.
Factory
---- of
316 13 4
Lunsoon
Servants’ per
0 8 0
rice month.
per
Ditto, 22⁄5 month
0 19
wages for
resiants.
Doll.
Servants’ wages for
20
the season
per
Stewards’ wages 80
annum.
Butlers’ ditto 80

Prices of Labour.
£ s. d.
A coolee, or per
0 0 8
porter day.
and
A taylor 0 0 5
rice.
A handicraftsman 0 0 8
A common to
0 0 3d.
labourer, from 5d.
A woman’s labour
considerably
cheaper.
CHAP. X.

LEAVE THE TYPA.—ORDERS OF THE COURT OF FRANCE


RESPECTING CAPTAIN COOK.—RESOLUTIONS IN CONSEQUENCE
THEREOF.—STRIKE SOUNDINGS ON THE MACCLESFIELD BANKS.
—PASS PULO SAPATA.—STEER FOR PULO CONDORE.—ANCHOR
AT PULO CONDORE.—TRANSACTIONS DURING OUR STAY.—
JOURNEY TO THE PRINCIPAL TOWN.—RECEIVE A VISIT FROM A
MANDARIN.—EXAMINE HIS LETTERS.—REFRESHMENTS TO BE
PROCURED.—DESCRIPTION AND PRESENT STATE OF THE
ISLAND.—ITS PRODUCE.—AN ASSERTION OF M. SONNERAT
REFUTED.—ASTRONOMICAL AND NAUTICAL OBSERVATIONS.

O n the 12th of January, 1780, at noon, we unmoored, and scaled


the guns, which, on board my ship, now amounted to ten; so that,
by means of four additional ports, we could, if occasion required,
fight seven on a side. In like manner, the Resolution had increased
the number of her guns from twelve to sixteen; and, in both ships, a
stout barricade was carried round their upper works, and every other
precaution taken to give our small force as respectable an
appearance as possible.
We thought it our duty to provide ourselves with these means of
defence, though we had some reason to believe, that the generosity
of our enemies had, in a great measure, rendered them superfluous.
We were informed at Canton, that the public prints, which had
arrived last from England, made mention of instructions having been
found on board all the French ships of war, captured in Europe,
directing their commanders, in case of falling in with the ships that
sailed under the command of Captain Cook, to suffer them to
proceed on their voyage without molestation. The same orders were
also said to have been given by the American Congress to the
vessels employed in their service. As this intelligence was farther
confirmed by private letters of several of the supercargoes, Captain
Gore thought himself bound, in return for the liberal exceptions
made in our favour, to refrain from availing himself of any
opportunities of capture, which these might afford, and to preserve,
throughout his voyage, the strictest neutrality.
At two in the afternoon, having got under sail, the Resolution
saluted the fort of Macao with eleven guns, which was returned with
the same number. At five, the wind dropping, the ship missed stays,
and drove into shallow water; but, by carrying out an anchor, she
was hauled off without receiving the smallest damage. The weather
continuing calm, we were obliged to warp out into the entrance of
the Typa, which we gained by eight o’clock, and lay there till nine
the next morning; when by the help of a fresh breeze from the east,
we stood to the southward between Potoe and Wungboo.
At noon, we were saluted by a Swedish ship as she passed us on
her way to Europe. At four, the Ladrone bore east, distant two
leagues. We now steered south half-east, with a fresh breeze from
the east-north-east, without any occurrence worth remarking, till
noon of the 15th; when, being in latitude 18° 57ʹ, and longitude
114° 13ʹ, the wind veering to the north, we directed our course half
a point more to the eastward, in order to strike soundings over the
Macclesfield Bank. This we effected at eight in the evening of the
16th, and found the depth of water to be fifty fathoms, over a
bottom of white sand and shells. This part of the Macclesfield shoals
we placed in latitude 15° 51ʹ, and longitude 114° 20ʹ; which agrees
very exactly with the position given in Mr. Dalrymple’s map, whose
general accuracy, if it stood in need of any support, was confirmed,
in this instance, by a great number of lunar observations, which we
had an opportunity of making every day since we left the Typa. The
variation was found to be, in the forenoon, 0° 39ʹ W.
On the 17th, we had heavy gales from the east by north, with a
rough tumbling sea, and the weather overcast and boisterous. On
the 18th, the wind still continued to blow strong, and the sea to run
high, we altered our course to south-west, by south; and, at noon,
being in latitude 12° 34ʹ, longitude 132°, we began to steer a point
more to the westward for Pulo Sapata, which we saw on the 19th, at
four in the afternoon, bearing north-west by west, about four
leagues distant. This small, high, barren island is called Sapata, from
its resemblance of a shoe. Our observations, compared with Mr.
Bayly’s time-keeper, place it in latitude 10° 4ʹ N., longitude 109° 10ʹ
E. The gale had, at this time, increased with such violence, and the
sea ran so high, as to oblige us to close-reef the top-sails. During
the last three days, the ships had outrun their reckoning at the rate
of twenty miles a-day; and as we could not attribute the whole of
this to the effects of a following sea, we imputed it in part to a
current, which, according to my own calculations, had set forty-two
miles to the south south-west, between the noon of the 19th and
the noon of the 20th; and is taken into the account in determining
the situation of the island.
After passing Sapata, we steered to the westward; and at
midnight sounded, and had ground with fifty fathoms of line, over a
fine sandy bottom. In the morning of the 20th, the wind becoming
more moderate, we let out the reefs, and steered west by south for
Pulo Condore. At noon the latitude was 8° 46ʹ N., longitude 106° 45ʹ
E.; and, at half-past twelve, we got sight of the island, bearing west.
At four, the extremes of Pulo Condore, and the islands that lie off it,
bore south-east and south-west by west; our distance from the
nearest islands being two miles. We kept to the north of the islands,
and stood for the harbour on the south-west end of Condore, which
having its entrance from the north-west, is the best sheltered during
the north-east monsoon. At six we anchored, with the best bower, in
six fathoms, veered away two-thirds of the cable, and kept the ship
steady with a stream anchor and cable to the south-east. When
moored, the extremes of the entrance of the harbour bore north by
west, and west north-west one quarter west; the opening at the
upper end south-east by east, three quarters east; our distance from
the nearest shore a quarter of a mile.
As soon as we were come to anchor, Captain Gore fired a gun,
with a view of apprising the natives of our arrival, and drawing them
toward the shore, but without effect. Early in the morning of the
21st, parties were sent to cut wood, which was Captain Gore’s
principal motive for coming hither. In the afternoon, a sudden gust
of wind broke the stream-cable, by which the Discovery was riding,
and obliged us to moor with the bower anchors.
None of the natives having yet made their appearance,
notwithstanding a second gun had been fired, Captain Gore thought
it advisable to land and go in search of them, that no time might be
lost in opening a trade for such provisions as the place could afford.
With this view he appointed me to accompany him in the morning of
the 22d; and, as the wind at this time blew strong from the east, we
did not think it prudent to coast in our boats to the town, which is
situated in the east side of the island, but rowed round the north
point of the harbour. We had proceeded about two miles along the
shore, when observing a road that led into a wood, we landed. Here
I quitted Captain Gore, taking with me a midshipman and four
armed sailors, and pursued the path which seemed to point directly
across the island. We proceeded through a thick wood up a steep
hill, to the distance of a mile, when, after descending through a
wood of the same extent, on the other side, we came out into a flat,
open, sandy country, interspersed with cultivated spots of rice and
tobacco, and groves of cabbage palm-trees, and cocoa-nut trees. We
here spied two huts situated on the edge of the wood, to which we
directed our course; and before we came up to them were descried
by two men, who immediately ran away from us, notwithstanding all
the peaceable and supplicating gestures we could devise.
On reaching the huts I ordered the party to stay without, lest the
sight of so many armed men should terrify the inhabitants, whilst I
entered and reconnoitred alone. I found in one of the huts an elderly
man who was in a great fright, and preparing to make off with the
most valuable of his effects that he could carry. However, I was
fortunate enough, in a very little time, so entirely to dispel his fears,
that he came out and called to the two men who were running away
to return. The old man and I now soon came to a perfect
understanding. A few signs, particularly that most significant one of
holding out a handful of dollars, and then pointing to a herd of
buffaloes, and the fowls that were running about the huts in great
numbers, left him without any doubts as to the real objects of our
visit. He pointed toward a place where the town stood, and made us
comprehend that, by going thither, all our wants would be supplied.
By this time the young men who had fled were returned, and the old
man ordered one of them to conduct us to the town as soon as an
obstacle should be removed, of which we were not aware. On our
first coming out of the wood, a herd of buffaloes, to the number of
twenty at least, came running toward us, tossing up their heads,
snuffing the air, and roaring in a hideous manner. They had followed
us to the huts, and stood drawn up in a body at a little distance; and
the old man made us understand that it would be exceedingly
dangerous for us to move till they were driven into the woods; but
so enraged were the animals grown at the sight of us, that this was
not effected without a good deal of time and difficulty. The men not
being able to accomplish it, we were surprized to see them call to
their assistance a few little boys who soon drove them out of sight.
Afterward we had occasion to observe, that in driving these animals
and securing them, which is done by putting a rope through a hole
which is made in their nostrils, little boys were always employed,
who could stroke and handle them with impunity at times when the
men durst not approach them. Having got rid of the buffaloes, we
were conducted to the town, which was at a mile’s distance, the
road to it lying through a deep white sand. It is situated near the
sea-side, at the bottom of a retired bay, which must afford a safe
road-stead during the prevalence of the south-west monsoons.
This town consists of between twenty and thirty houses, built
close together; besides six or seven others that are scattered about
the beach. The roof, the two ends, and the side fronting the country,
are neatly constructed of reeds; the opposite side, facing the sea, is
entirely open; but, by means of a sort of bamboo screens, they can
exclude or let in as much of the sun and air as they please. We
observed likewise other large screens or partitions for the purpose of
dividing, as occasion required, the single room of which the house,
properly speaking, consists, into separate apartments.
We were conducted to the largest house in the town belonging to
their chief, or, as they called him, their captain. This house had a
room at each end, separated by a partition of reeds from the middle
space, which was open on both sides, and provided with partition-
screens like the others. It had, besides, a penthouse projecting four
or five feet beyond the roof, and running the whole length on each
side. At each end of the middle room were hung some Chinese
paintings, representing men and women in ludicrous attitudes. In
this apartment we were civilly desired to seat ourselves on mats,
and betel was presented to us.
By means of my money, and pointing at different objects in sight,
I had no difficulty in making a man, who seemed to be the principal
person of the company, comprehend the main business of our
errand; and I as readily understood from him that the chief or
captain was absent, but would soon return, and that, without his
consent, no purchases of any kind could be made. We availed
ourselves of the opportunity which this circumstance afforded us to
walk about the town; and did not forget to search, though in vain,
for the remains of a fort, which had been built by our countrymen
near the spot we were now upon in 1702.[80]
On returning to the captain’s house, we were sorry to find that he
was not yet arrived, and the more so, as the time was almost
elapsed which Captain Gore had fixed for our return to the boat. The
natives were desirous we should lengthen our stay; they even
proposed our passing the night there, and offered to accommodate
us in the best manner in their power. I had observed when we were
in the house before, and now remarked it the more, that the man I
have mentioned above, frequently retired into one of the end rooms,
and staid there some little time before he answered the questions
that were put to him; which led me to suspect that the captain was
all the time there, though, for reasons best known to himself, he did
not choose to appear; and I was confirmed in this opinion by being
stopped as I was attempting to go into the room. At length, it clearly
appeared that my suspicions were well founded; for, on our
preparing to depart, the person who had so often passed in and out,
came from the room with a paper in his hand, and gave it to me to
read; and I was not a little surprised to find it a sort of certificate in
French as follows:
Pierre Joseph George, Evêque d’Adran, Vicaire Apost. de Cochin China,
&c. &c.
Le petit Mandarin, porteur de cet écrit, est véritablement envoyé
de la cour à Pulo Condore, pour y attendre et recevoir tout vaisseau
Européen qui auroit sa destination d’approcher ici. Le capitaine, en
consequence, pourroit se fier ou pour conduire le vaisseau au port,
ou pour faire passer les nouvelles qu’il pourroit croire nécessaire.
PIERRE JOSEPH GEORGE,
Evêque d’Adran.

A Sai-Gon,
10 d’Août, 1779.

We returned the paper, with many protestations of our being the


Mandarin’s good friends; begging he might be informed that we
hoped he would do us the favour to visit the ships, that we might
convince him of it. We now took our leave, well satisfied, on the
whole, with what had passed, but full of conjectures about this
extraordinary French paper. Three of the natives offered their
services to accompany us back, which we readily accepted, and
returned by the way we came. Captain Gore felt peculiar satisfaction
at seeing us; for, as we had exceeded our time near an hour, he
began to be alarmed for our safety, and was preparing to march
after us. He and his party had, during our absence, been profitably
employed in loading the boat with the cabbage-palm, which abounds
in this bay. Our guides were made exceedingly happy, on our
presenting them with a dollar each for their trouble, and intrusting to
their care a bottle of rum for the Mandarin. One of them chose to
accompany us on board.
At two in the afternoon we joined the ships, and several of our
shooting parties returned about the same time from the woods,
having had little success, though they saw a great variety of birds
and animals, some of which will be hereafter noticed.
At five, a proa with six men rowed up to the ship, from the upper
end of the harbour, and a decent-looking personage introduced
himself to Captain Gore with an ease and good breeding, which
convinced us his time had been spent in other company than what
this island afforded. He brought with him the French paper above
transcribed, and said he was the Mandarin mentioned in it. He spoke
a few Portugueze words, but as none of us were acquainted with
this language, we were obliged to have recourse to a black man on
board, who could speak the Malay, which is the general language of
these islanders, and was understood by the Mandarin. After a little
previous conversation, he declared to us, that he was a Christian,
and had been baptized by the name of Luco; that he had been sent
hither in August last, from Sai-gon, the capital of Cochin China, and
had since waited in expectation of some French ships, which he was
to pilot to a safe port, not more than a day’s sail hence, upon the
coast of Cochin China. We acquainted him, that we were not French,
but English, and asked him whether he did not know that these two
nations were now at war with one another? He made answer in the
affirmative; but, at the same time, signified to us, that it was
indifferent to him to what nation the ships he was instructed to wait
for belonged, provided their object was to trade with the people of
Cochin China. He here produced another paper, which he desired us
to read. This was a letter sealed and directed, “To the captains of
any European vessels that may touch at Condore.” Although we
apprehended that this letter was designed for French ships in
particular, yet as the direction included all European captains, and as
Luco was desirous of our perusing it, we broke the seal, and found it
to be written by the bishop who wrote the certificate. Its contents
were as follows: “That having reason to expect, by some late
intelligence from Europe, that a vessel would soon come to Cochin
China, he had, in consequence of this news, got the court to send a
Mandarin (the bearer) to Pulo Condore, to wait its arrival; that if the
vessel should put in there, the commander might either send by the
bearer an account to him of his arrival, or trust himself to the
Mandarin, who would pilot him into a well-sheltered port in Cochin
China, not more than a day’s sail from Condore; that should he
choose to remain in Condore, till the return of the messenger, proper
interpreters would be sent back, and any other assistance, which a
letter should point out, be furnished; that it was unnecessary to be
more particular, of which the captain himself must be sensible.” This
letter had the same date as the certificate, and was returned to Luco
again, without any copy being taken.
From this letter, and the whole of Luco’s conversation, there
remained little doubt that it was a French ship he was to expect. At
the same time, we found he would be glad not to lose his errand,
and had no objection to become our pilot. We could not discover
from the Mandarin, the exact object and business which the vessel
he was waiting for intended to prosecute in Cochin China. It is true,
that our interpreter, the black, was extremely dull and stupid; and I
should, therefore, be sorry, with such imperfect means of
information, to run the risk of misleading the reader by any
conjectures of my own, respecting the object of Luco’s visit to this
island. I shall only add, that he told us the French ships might
perhaps have put into Tirnon, and from thence sail to Cochin China;
and, as he had received no intelligence of them, he thought this
most likely to have been the case.
Captain Gore’s inquiries were next directed to find out what
supplies could be obtained from the island. Luco said, that he had
two buffaloes of his own, which were at our service; and that there
were plenty on the island, which might be purchased for four or five
dollars a head; but finding that Captain Gore thought that sum
exceedingly moderate, and would willingly give for them a much
greater, the price was afterwards raised upon us to seven and eight
dollars.
Early in the morning of the 23d, the launches of both ships were
sent to the town, to fetch the buffaloes which we had given orders
to be purchased; but they were obliged to wait, till it was high-water,
as they could at no other time get through the opening at the head
of the harbour. On their arrival at the village, they found the surf
breaking on the beach with such force, that it was with the utmost
difficulty each launch brought a buffalo on board in the evening, and
the officers, who were sent on this service, gave it as their opinion,
that between the violence of the surf, and the fierceness of the
buffaloes, it would be extremely imprudent to attempt bringing any
more off in this way. We had purchased eight, and were now at a
loss in what manner to proceed to get them on board. We could kill
no more than was just necessary for the consumption of one day, as
in this climate meat will not keep till the next. After consulting with
Luco, it was concluded, that the remainder should be driven through
the wood, and over the hill down to the bay, where Captain Gore
and I had landed the day before, which being sheltered from the
wind, was more free from surf. This plan was accordingly put in
execution, but the untractableness and prodigious strength of the
buffaloes, rendered it a tedious and difficult operation. The method
of conducting them was, by passing ropes through their nostrils, and
round their horns; but having been once enraged at the sight of our
men, they became so furious, that they sometimes broke the trees,
to which we were often under the necessity of tying them;
sometimes they tore asunder the cartilage of the nostril, through
which the ropes ran, and got loose. On these occasions, all the
exertions of our men to recover them, would have been ineffectual,
without the assistance of some young boys, whom these animals
would permit to approach them, and by whose little managements
their rage was soon appeased. And, when at length they were got
down to the beach, it was by their aid, in twisting ropes round their
legs, in the manner they were directed, that we were enabled to
throw them down, and by that means to get them into the boats. A
circumstance, respecting these animals, which I thought no less
singular than this gentleness toward, and, as it should seem,
affection for little children, was, that they had not been twenty-four
hours on board, before they became the tamest of all creatures. I
kept two of them, a male and female, for a considerable time, which
became great favourites with the sailors; and thinking that a breed
of animals of such strength and size, some of them weighing, when
dressed, seven hundred pounds’ weight, would be a valuable
acquisition, I was inclined to have brought them with me to England;
but my intention was frustrated by an incurable hurt that one of
them received at sea.
It was not till the 28th, that the buffaloes were all got on board;
however, there was no reason to regret the time taken up by this
service, since, in the interim, two wells of excellent water had been
discovered, of which, as also of wood, part of the ships’ companies
had been employed in laying in a good supply; so that a shorter stop
would be necessary for replenishing our stock of these articles, in
the Strait of Sunda. A party had likewise been occupied in drawing
the seine at the head of the harbour, where they took a great many
good fish; and another party in cutting down the cabbage-palm,
which was boiled, and served out with the meat. Besides this, having
been able to procure only a scanty supply of cordage at Macao, the
repairing of our rigging was become an object of constant attention,
and demanded all our spare time.
Pulo Condore is high and mountainous, and surrounded by several
smaller islands, some of which are less than one, and others two
miles distant. It takes its name from two Malay words, Pulo,
signifying an island, and Condore, a calabash, of which it produces
great quantities. It is of the form of a crescent, extending near eight
miles from the southernmost point, in a north-east direction; but its
breadth no where exceeds two miles. From the westernmost
extremity, the land trends to the south-east for about four miles; and
opposite to this part of the coast there is an island, called by
Monsieur D’Après[81] Little Condore, which runs two miles in the
same direction. This position of the two islands affords a safe and
commodious harbour, the entrance into which is from the north-
west. The distance between the two opposite coasts is three-
quarters of a mile, exclusive of a border of coral rock, which runs
down along each side, extending about one hundred yards from the
shore. The anchorage is very good, from eleven to five fathoms’
water, but the bottom is so soft and clayey, that we found great
difficulty in weighing our anchors. Toward the bottom of the harbour
there is shallow water for about half a mile, beyond which the two
islands approach so near each other, as to leave only a passage at
high water for boats. The most convenient place for watering is at a
beach on the eastern side, where there is a small stream which
furnished us with fourteen or fifteen tons of water a-day.
This island, both with respect to animal and vegetable
productions, is considerably improved since the time when Dampier
visited it. Neither that writer, nor the compiler of the East India
Directory, make mention of any other quadrupeds than hogs, which
are said to be very scarce, lizards, and the guanoes; and the latter,
on the authority of Monsieur Dedier, a French engineer, who
surveyed the island about the year 1720, says, that none of the
fruits and esculent plants, so common in the other parts of India,
are to be found here, except water-melons, a few potatoes, small
gourds, chibbols (a small species of onion), and little black beans. At
present, besides the buffaloes, of which we understood there were
several large herds, we purchased from the natives some remarkably
fine fat hogs, of the Chinese breed. They brought us three or four of
a wild sort; and our sportsmen reported, that they frequently met
with their tracks in the woods, which also abound with monkeys and
squirrels, but so shy, that it was difficult to shoot them. One species
of the squirrel was of a beautiful shining black colour, and another
species striped brown and white. This is called the flying-squirrel,
from being provided with a thin membrane, resembling a bat’s wing,
extending on each side the belly, from the neck to the thighs, which,
on stretching out their legs, spreads, and enables them to fly from
tree to tree, at a considerable distance. Lizards were in great
abundance; but I do not know that any of us saw the guano, and
another animal, described by Dampier[82] as resembling the guano,
only much larger.
Amongst its vegetable improvements, I have already mentioned
the fields of rice we passed through; and plantains, various kinds of
pompions, cocoa-nuts, oranges, shaddocks, and pomegranates,
were also met with; though, except the plantains and shaddocks, in
no great abundance.
It is probable, from what has been already said relative to the
bishop of Adran, that the French have introduced these
improvements, into the island, for the purpose of making it a more
convenient refreshing station for any of their ships that may be
bound for Cambodia, or Cochin China. Should they have made, or
intend to make, any settlement in those countries, it is certainly well
situated for that purpose, or for annoying the trade of their enemies,
in case of war.
Our sportsmen were very unsuccessful in their pursuit of the
feathered game, with which the woods are well stocked. One of our
gentlemen had the good fortune to shoot a wild hen; and all the
shooting parties agreed that they heard the crowing of the cocks on
every side, which they described to be like that of our common cock,
but shriller; that they saw several of them on the wing, but that they
were exceedingly shy. The hen that was shot was of a speckled
colour, and of the same shape, though not quite so large, as a full
grown pullet of this country. Monsieur Sonnerat has entered into a
long dissertation, to prove that he was the first person who
determined the country to which this most beautiful and useful bird
belongs, and denies that Dampier met with it here.
The land in the neighbourhood of the harbour is a continued high
hill, richly adorned with a variety of fine tall trees, from the summit
to the water’s edge. Among others, we observed what Dampier calls
the tar-tree[83]; but observed none that were tapped in the manner
he describes.
The inhabitants, who are fugitives from Cambodia and Cochin
China, are not numerous. They are of a short stature, and very
swarthy, and of a weak and unhealthy aspect; but, as far as we
could judge, of a gentle disposition.
We remained here till the 28th of January; and, at taking leave of
the Mandarin, Captain Gore, at his own request, gave him a letter of
recommendation to the commanders of any other ships that might
put in here; to which he added a handsome present. He likewise
gave him a letter for the bishop of Adran, together with a telescope,
which he begged might be presented to him as a compliment for the
services he had received through his means at Condore.
The harbour at Pulo
Condore is in latitude 8° 40ʹ 00ʺ N.
Longitude, deduced from a
great number of lunar
observations, 106 18 46 E.
Dip of the north pole of the
magnetic needle, 2 1 0
Variation of the compass, 0 14 0 W.
High water at the full and change of the moon, 4h
16m apparent time.
From this time, the water continued for twelve hours without any
visible alteration, viz. till 16h 15m apparent time, when it began to
ebb; and at 22h 15m apparent time, it was low water. The change
from ebbing to flowing was very quick, or in less than 5m. The water
rose and fell seven feet four inches perpendicular; and every day the
same whilst we continued there.
CHAP. XI.

DEPARTURE FROM PULO CONDORE.—PASS THE STRAITS OF


BANCA.—VIEW OF THE ISLAND OF SUMATRA.—STRAITS OF
SUNDA.—OCCURRENCES THERE.—DESCRIPTION OF THE ISLAND
OF CRACATOA.—PRINCE’S ISLAND.—EFFECTS OF THE CLIMATE
OF JAVA.—RUN TO THE CAPE OF GOOD HOPE.—TRANSACTIONS
THERE.—DESCRIPTION OF FALSE BAY.—PASSAGE TO THE
ORKNEYS.—GENERAL REFLECTIONS.

O n the 28th day of January 1780, we unmoored; and, as soon as


we were clear of the harbour, steered south south-west for Pulo
Timoan. On the 30th, at noon, the latitude, by observation, being 5°
0ʹ N., and longitude 104° 45ʹ E. we altered our course to south three
quarters west, having a moderate breeze from the north-east,
accompanied by fair weather. At two in the morning of the 31st, we
had soundings of forty-five fathoms, over a bottom of fine white
sand; at which time our latitude was 4° 4ʹ N., longitude 104° 29ʹ E.,
and the variation of the compass 0° 31ʹ E.
At one in the afternoon, we saw Pulo Timoan; and, at three, it
bore south south-west, three quarters west, distant ten miles. This
island is high and woody, and has several small ones lying off to the
westward. At five, Pulo Puisang was seen bearing south by east
three quarters east; and, at nine, the weather being thick and hazy,
and having out-run our reckoning from the effect of some current,
we were close upon Pulo Aor, in latitude 2° 46ʹ N., longitude 104°
37ʹ E., before we were well aware of it, which obliged us to haul the
wind to the east south-east. We kept this course till midnight, and
then bore away south south-east for the Straits of Banca.
On the 1st of February, at noon, our latitude, by observation, was
1° 20ʹ N., and the longitude, deduced from a great number of lunar
observations taken in the course of the preceding twelve hours, 105°
E. At the same time, the longitude, by Mr. Bayly’s time-keeper,
corrected, was 105° 15ʹ E. We now steered south by east; and, at
sun-set, having fine clear weather, saw Pulo Panjang; the body of
the island bearing west north-west, and the small islands, lying on
the south-east of it, west half south, seven leagues distant. Our
latitude, at this time, was 0° 53ʹ N.
On the 2d, at eight in the morning, we tried for soundings,
continuing to do the same every hour, till we had passed the Straits
of Sunda, and found the bottom with twenty-three fathoms of line.
At noon, being in latitude, by observation, 0° 22ʹ S., longitude 105°
14ʹ E., and our soundings twenty fathoms, we came in sight of the
little islands called Dominis, which lie off the eastern part of Lingen;
and which bore from north 62° W., to north 80° W., five leagues
distant. At this time we passed a great deal of wood, drifting on the
sea; and, at one o’clock, we saw Pulo Taya, bearing south-west by
west, distant seven leagues. It is a small high island, with two round
peaks, and two detached rocks lying off it to the northward. When
abreast of this island, we had soundings of fifteen fathoms. During
this and the preceding day, we saw great quantities of a reddish
coloured scum or spawn, floating on the water, in a southerly
direction.
At day-light, on the 3d, we came in sight of the Three Islands;
and, soon after, of Monopin Hill, on the island of Banca. At noon, this
hill, which forms the north-east point of the entrance of the Straits,
bore south-east half south, distant six leagues; our latitude, by
observation, being 1° 48ʹ S., and longitude 105° 3ʹ E., the soundings
seventeen fathoms, and no perceivable variation in the compass.
Having got to the westward of the shoal, called Frederick Endric,
at half past two we entered the Straits, and bore away to the
southward; and, in the afternoon, Monopin Hill bearing due east, we
determined its latitude to be 2° 3ʹ S., the same as in Mons. D’Après’
map, and its longitude 105° 18ʹ E. At nine, a boat came off from the
Banca shore, and having rowed round the ships, went away again.
We hailed her in the Malay tongue to come on board, but received
no answer. At midnight, finding a strong tide against us, we
anchored in twelve fathoms, Monopin Hill bearing north 29° W.
On the 4th, in the morning, after experiencing some difficulty in
weighing our anchors, owing to the stiff tenacious quality of the
ground, we proceeded with the tide down the Straits; the little wind
we had from the northward dying away as the day advanced. At
noon, there being a perfect calm, and the tide making against us,
we dropt our anchor in thirteen fathoms’ water, about three miles
from what is called the Third Point, on the Sumatra, shore; Monopin
Hill bearing N. 54° W. The latitude, by observation, was 2° 22ʹ S.,
longitude 105° 38ʹ E. At three, in the afternoon, we weighed and
stood on through the Straits with a light breeze; and, at eight, were
abreast of the second point, and passed it within two miles, in
seventeen fathoms’ water, a sufficient proof, that this point may be
bordered upon with safety. At midnight, we again came to anchor,
on account of the tide, in thirteen fathoms, Mount Permissang, on
the island of Banca, bearing N. 7° E., and the First Point S. 54° E.,
distant about three leagues.
In the morning of the 5th, we weighed, and kept on to the south-
east; and, at ten, passed a small shoal, lying in a line with Lusepara
and the First Point, at the distance of five miles from the latter. At
noon, the island of Lusepara, bearing S. 571⁄2° E., four miles distant,
we determined its latitude to be 3° 101⁄2ʹ S., and longitude 106° 15ʹ
E. The difference of longitude between the island Lusepara, which
lies in the south entrance of the Straits of Banca, and Monopin Hill,
which forms one side of the entrance from the north, we found to be
55ʹ, which is only two miles less than what is given in D’Après’ chart.
In passing these Straits, the coast of Sumatra may be approached
somewhat closer than that of Banca. At the distance of two or three
miles from the shore, there are ten, eleven, twelve, or thirteen
fathoms, free from rocks or shoals; however, the lead is the surest
guide. The country is covered with wood down to the water’s edge,
and the shores are so low, that the sea overflows the land, and
washes the trunks of the trees. To this flat and marshy situation of
the shore, we may attribute those thick fogs and vapours, which we
perceived every morning, not without dread and horror, hanging
over the island, till they were dispersed by the rays of the sun. The
shores of Banca are much bolder, and the country inland rises to a
moderate height, and appears to be well wooded throughout. We
often saw fires on this island during the night time; but none on the
opposite shore. The tide runs through the Straits at the rate of
between two and three knots an hour.
In the morning of the 6th, we passed to the westward of
Lusepara, at the distance of four or five miles; generally carrying
soundings of five and six fathoms’ water, and never less than four.
We afterward steered south by east; and having brought Lusepara
to bear due north, and deepened our water to seven fathoms, we
altered our course to south by west, keeping the lead going, and
hauling out a little, whenever we shoaled our water. The soundings
on the Sumatra side we still found to be regular, and gradually
shoaling, as we approached the shore. At five in the afternoon we
saw the Three Sisters, bearing south by west half west; and, at
seven, we came to an anchor in ten fathoms, about eight miles to
the north of the islands. The weather was close and sultry, with light
winds, generally from the north-west; but sometimes varying round
as far as the north-east; and, during the night, we observed much
lightning over Sumatra.
We weighed the next morning at five, and at eight were close in
with the Sisters. These are two very small islands, well covered with
wood, lying in latitude 5° 01⁄2ʹ S., longitude 106° 12ʹ E., nearly north
and south from each other, and surrounded by a reef of coral rocks;
the whole circumference of which is about four or five miles. At noon
we got sight of the island of Java to the southward; the north-west
extremity of which (Cape St. Nicholas) bore south; North Island, on
the Sumatra shore, S. 27° W., and the Sisters north, 27° E., distant
four leagues; our latitude was 5° 21ʹ S., longitude 105° 57ʹ E.
At four in the afternoon, we saw two sail in the Straits of Sundy;
one lying at anchor near the Mid-channel Island; the other nearer
the Java shore. Not knowing to what nation they might belong, we
cleared our ships for action; and at six came to an anchor in twenty-
five fathoms, four miles east by south from North Island. Here we
lay all night, and had very heavy thunder and lightning to the north-
west; from which quarter the wind blew in light breezes,
accompanied with hard rain.
At eight o’clock the next morning, we weighed, and proceeded
through the Straits, the tide setting to the southward, as it had done
all night; but about ten the breeze failing, we came to again in
thirty-five fathoms; a high island, or rather rock, called the Grand
Toque, bearing south by east. We were, at this time, not more than
two miles from the ships, which now hoisting Dutch colours, Captain
Gore sent a boat on board for intelligence. The rain still continued
with thunder and lightning.
Early in the afternoon, the boat returned with an account that the
large ship was a Dutch East-Indiaman, bound for Europe; and the
other a packet from Batavia, with orders for the several ships lying in
the Straits. It is the custom for the Dutch ships, as soon as their
lading is nearly completed, to leave Batavia, on account of its
extreme unwholesomeness, and proceed to some of the more
healthy islands in the Straits, where they wait for the remainder of
their cargo, and their dispatches. Notwithstanding this precaution,
the Indiaman had lost, since her departure from Batavia, four men,
and had as many more whose recovery was despaired of. She had
lain here a fortnight, and was now about to proceed to water at
Cracatoa, having just received final orders by the packet.
At seven in the morning of the 9th, we weighed, and stood on
through the Straits to the south-west, keeping pretty close in with
the islands on the Sumatra shore, in order to avoid a rock near Mid-
channel Island, which lay on our left. At half after ten, I received
orders from Captain Gore to make sail toward a Dutch ship which
now hove in sight to the southward, and which we supposed to be
from Europe; and, according to the nature of the intelligence we
could procure from her, either to join him at Cracatoa, where he
intended to stop, for the purpose of supplying the ships with arrack,
or to proceed to the south-east end of Prince’s Island, and there
take in our water, and wait for him.
I accordingly bore down toward the Dutch ship, which, soon after,
came to an anchor to the eastward; when the wind slackening, and
the current still setting very strong through the strait to the south-
west, we found it impossible to fetch her, and having, therefore, got
as near her as the tide would permit, we also dropped anchor. I
immediately dispatched Mr. Williamson, in the cutter, with orders to
get on board her if possible; but as she lay near a mile off, and the
tide ran with great rapidity, we soon perceived, that the boat was
dropping fast astern. We therefore made the signal to return, and
immediately began to veer away the cable, and sent out a buoy
astern, in order to assist him in getting on board again. Our poverty,
in the article of cordage, was here very conspicuous; for we had not
a single coil of rope, in the store-room, to fix to the buoy, but were
obliged to set about unreeving the studding-sail gear, the top-sail-
halliards, and tackle-falls, for that purpose; and the boat was at this
time driving to the southward so fast, that it was not before we had
veered away two cables, and almost all our running rigging, that she
could fetch the buoy.
I was now under the necessity of waiting till the strength of the
tide should abate, which did not happen till the next morning, when
Mr. Williamson got on board the ship, and learnt, that she had been
seven months from Europe, and three from the Cape of Good Hope;
that before she sailed, France and Spain had declared war against
Great Britain; and that she left Sir Edward Hughes, with a squadron
of men-of-war, and a fleet of East-India ships, at the Cape. Mr.
Williamson having, at the same time, been informed, that the water
at Cracatoa was very good, and always preferred, by the Dutch
ships, to that of Prince’s Island, I resolved to rejoin the Resolution at
the former place; and a fair breeze springing up, we weighed and
stood over toward the island, where we soon after saw her at
anchor; but the wind falling, and the tide setting strong against us, I
was obliged to drop anchor, at the distance of about five miles from
the Resolution, and immediately sent a boat on board, to acquaint
Captain Gore with the intelligence we had received.
As soon as the Resolution saw us preparing to come to, she fired
her guns, and hoisted an English jack at the ensign staff, the signal
at sea to lead ahead. This we afterward understood was intended to
prevent our anchoring, on account of the foul ground, which the
maps she had on board placed here. However, as we found none,
having a muddy bottom, and good holding ground, in sixty fathoms
water, we kept fast till the return of the boat, which brought orders
to proceed the next morning to Prince’s Island. We were at this time
two miles distant from the shore; the peak of Cracatoa bore north-
west by north; Bantam Point east north-east half east; Prince’s
Island south-west by west.
The island of Cracatoa is the southernmost of a group situated in
the entrance of the Straits of Sunda. It has a high-peaked hill on the
south end[84], which lies in latitude 6° 9ʹ S., and longitude 105° 15ʹ
E.; the whole circuit of the island is not more than three leagues. Off
the north-east end lies a small island, which forms the road where
the Resolution anchored; and within a reef that runs off the south
end of the latter, there is good shelter against all northerly winds,
with eighteen fathoms water near the reef, and twenty-seven in the
mid-channel. To the north-west, there is a narrow pass for boats
between the two islands.
The shore, which forms the western side of the road, is in a north-
west direction, and has a bank of coral stretching into the sea, about
one third of a cable’s length, which makes the landing difficult for
boats, except at high water; but the anchoring ground is very good,
and free from rocks. The place where the Resolution watered is a
small spring, situated abreast of the south end of the small island, at
a short distance from the water-side. A little to the southward, there
is a very hot spring, which is used by the natives as a bath. Whilst
we were lying off the south end of this island, we sent a boat with
the Master on shore, to look for water; but after having landed with
some difficulty, he returned unsuccessful.
Cracatoa is esteemed very healthy, in comparison of the
neighbouring countries. It consists of high land, rising gradually on
all sides from the sea; and the whole is covered with trees, except a
few spots which the natives have cleared for rice fields. The number
of people on the island is very inconsiderable. Their chief, as are
those of all the other islands in the Straits, is subject to the king of
Bantam. The coral reefs afford plenty of small turtles; but other
refreshments are very scarce, and sold at an enormous price.
Latitude of the road where the
Resolution anchored, 8° 6ʹ south.
Longitude, by Mr. Bayly’s time-
keeper, 104 48 east.
Ditto, by observation 105 36 east.
Dip of the south end of the
magnetic needle 26 3
Variation of the compass, 1 0 west.
On the full and change days, it is high-water at 7h in the morning.
The water rises three feet two inches perpendicular.
At eight o’clock in the evening, it began to blow fresh from the
westward, with violent thunder, lightning, and rain; and at three the
next morning, we weighed and stood over for Prince’s Island, but
the westerly wind dying away, was succeeded by a breeze from the
south-east, and, at the same time, a strong tide setting to the south-
west prevented our fetching the island, and obliged us, at two in the
afternoon, to drop anchor in sixty-five fathoms, over a muddy
bottom, at three leagues distance from it; the high hill bearing
south-west by south, and the peak on Cracatoa north by east. We
had light airs and calms till six next morning, when we weighed and
made sail, having, in our endeavours to heave the anchor out of the
ground, twice broken the old messenger, and afterward a new one,
cut out of our best hawser. This, however, was entirely owing to the
wretched state of our cordage, as the strain was not very
considerable, and we had besides assisted the cable in coming in, by
clapping the cat-tackle on it. The wind continuing fair, at noon we
came to an anchor off the south-east end of Prince’s Island, in
twenty-six fathoms, over a sandy bottom; the east end of the island
bearing north north-east, the southernmost point in sight south-west
by south, the high peak north-west half west, distant from the
nearest shore half a mile.
As soon as we had come to anchor, Lieutenant Lannyon, who had
been here before with Captain Cook, in the year 1770 was sent
along with the master, to look for the watering-place. The brook
from which, according to the best of his recollection, the Endeavour
had been supplied, was found quite salt. Further inland, they saw a
dry bed, where the water seemed to have lodged in rainy seasons;
and, about a cable’s length below, another run, supplied from an
extensive pool, the bottom of which, as well as the surface, was
covered with dead leaves. This, though a little brackish, being much
preferable to the other, we began watering here early the next
morning, and finished the same day.
The natives, who came to us soon after we anchored, brought a
plentiful supply of large fowls, and some turtles; but the last were
for the most part very small. In the course of the night we had
heavy rain; and on the 14th, at day-light, we saw the Resolution to
the northward, standing toward the island, and at two in the
afternoon, she dropt anchor close to us. In the course of the day, we
heeled the ship, and scrubbed and hogged her bottom, which was
very foul; and got ready for sea.
The next day, Captain Gore not having completed his stock of
water at Cracatoa, sent his men on shore, who now found the brook
that was first mentioned, rendered perfectly sweet by the rain, and
flowing in great abundance. This being too valuable a treasure to be
neglected, I gave orders, that all the casks we had filled before
should be started, and replenished with the fresh water, which was
accordingly done before noon the next day; and in the evening, we
cleared the decks, and both ships were ready for sea.
In the forenoon of the 18th, we had heavy rains, and variable
winds, which prevented our getting under weigh till two in the
afternoon, when a light wind sprung up from the northward; but this
soon after leaving us, we were obliged to drop our anchor again at
eight o’clock that night, in fifty fathoms’ water, and wait till the same
hour the next morning. At that time, being favoured by a breeze
from the north-west, we broke ground, to our inexpressible
satisfaction, for the last time in the Straits of Sunda, and, the next
day, had entirely lost sight of Prince’s Island.
This island having been already described by Captain Cook, in the
history of a former voyage, I shall only add, that we were
exceedingly struck with the great general resemblance of the
natives, both in figure, colour, manners, and even language, to the
nations we had been so much conversant with, in the South Seas.
The effects of the Javanese climate, and I did not escape without my
full share of it, made me incapable of pursuing the comparison so
minutely as I could have wished.
The country abounds with wood to such a degree, that
notwithstanding the quantity cut down every year by the ships which
put into the road, there is no appearance of its diminution. We were
well supplied with small turtle and fowls of a moderate size; the last
were sold at the rate of ten for a Spanish dollar. The natives also
brought us many hog-deer, and a prodigious number of monkeys, to
our great annoyance, as most of our sailors provided themselves
with one, if not two of these troublesome animals.
As we should have met with some difficulty in finding the
watering-place, if Mr. Lannyon had not been with us, it may be
worth while, for the use of future navigators, to describe its situation
more particularly. The peaked hill on the island bears from it north-
west by north; a remarkable tree growing upon a coral reef, and
quite detached from the neighbouring shrubs, stands just to the
northward; and, close by it, there is a small plot of reedy grass, the
only piece of the kind that can be seen hereabout. These marks will
show the place where the pool empties itself into the sea; but the
water here is generally salt as well as that which is in the pool. The
casks must, therefore, be filled about fifty yards higher up; where, in
dry seasons, the fresh water that comes down from the hills is lost
among the leaves, and must be searched for by clearing them away.
The latitude of
the anchoring-
place at 6° 36ʹ 15ʺ S.
Prince’s Island
was,
Longitude, 105 17 30 E.
Dip of the
south pole of
28 15 0
the magnetic
needle,
Variation of the
0 54 0 W.
compass,
Mean of the 01⁄2
83 0
thermometer,
From the time of our entering the Straits of Banca, we began to
experience the powerful effects of this pestilential climate. Two of
our people fell dangerously ill of malignant putrid fevers; which,
however, we prevented from spreading, by putting the patients apart
from the rest, in the most airy births. Many were attacked with
teazing coughs; others complained of violent pains in the head; and
even the healthiest among us felt a sensation of suffocating heat,
attended by an insufferable languor, and a total loss of appetite. But
though our situation was, for a time, thus uneasy and alarming, we
had, at last, the singular satisfaction of escaping from these fatal
seas without the loss of a single life; a circumstance which was
probably owing in part to the vigorous health of the crews when we
first arrived here, as well as to the strict attention now become
habitual in our men, to the salutary regulations introduced amongst
us by Captain Cook.
On our leaving Prince’s Island, and during the whole time of our
run from thence to the Cape of Good Hope, the crew of the
Resolution was in a much more sickly state than that of the
Discovery; for, though many of us continued for some time
complaining of the effects of the noxious climate we had left, yet
happily we all recovered from them. Of the two who had been ill of
fevers, one, after being seized with violent convulsions on the 12th
of February, which made us despair of his life, was relieved by the
application of blisters, and was soon after out of danger. The other
recovered, but more slowly. On board the Resolution, besides the
obstinate coughs and fevers under which they very generally
laboured, a great many were afflicted with fluxes, the number of
whom, contrary to our expectations, continued increasing till our
arrival at the Cape.
Captain Gore attributed this difference in part, and probably with
some reason, to the Discovery having her fire-place between decks;
the heat and smoke of which he conceived might help to mitigate
the bad effects of the damp night air. But I am rather inclined to
believe that we escaped the flux by the precautions that were taken
to prevent our catching it from others. For if some kinds of fluxes be,
as I apprehend there is no doubt they are, contagious, it is not
improbable that the Resolution caught this disorder from the Dutch
ships at Cracatoa. In order to avoid this danger, when Mr. Williamson
was sent to the Indiaman in the entrance of the Straits of Sunda, he
had the strictest orders not to suffer any of our people, on any
account whatever, to go on board; and whenever we had afterward
occasion to have any communication with the Resolution, the same
caution was constantly observed.
We were no sooner clear of Prince’s Island, than we had a gentle
breeze from the west north-west; but this did not last long; for the
following day the wind became again variable, and continued so till
the noon of the 25th, when it blew squally, and blew fresh from the
north.
On the 22d at noon, being in latitude 10° 28ʹ S., and longitude
104° 14ʹ, we saw great quantities of boobies and other fowls that
seldom go far from land; from which, we conjectured that we were
near some small unknown island.
In the evening of the 25th, the wind changed suddenly to the
southward, accompanied with heavy rains, and began to blow with
great violence. During the night, almost every sail we had bent gave
way, and most of them were split to rags; our rigging also suffered
materially, and we were, the next day, obliged to bend our last suit
of sails, and to knot and splice the rigging, our cordage being all
expended. This sudden storm we attributed to the change from the
monsoon to the regular trade-wind; our latitude was about 13° 10ʹ
S. and we had made by our reckoning about 41⁄2° of longitude west
from Java head.
From the 26th of this month to the 28th of March, we had a
regular trade-wind from the south-east to east by south, with fine
weather; and, being in an old beaten track, met no occurrence that
deserved the smallest notice.
In the morning of the 28th of March, being in latitude 31° 42ʹ S.,
and longitude 35° 26ʹ E., the trade-wind left us in a violent thunder-
storm. From this time to the 3d of April, when our latitude was 35°
1ʹ S., and longitude 26° 3ʹ E. the winds were moderate, and
generally from the south quarter. A fresh breeze then sprung up
from the eastward, which continued till the afternoon of the 4th;
after which, we had a calm that lasted the two following days.
It had hitherto been Captain Gore’s intention to proceed directly to
St. Helena, without stopping at the Cape; but the rudder of the
Resolution having been for some time complaining, and, on being
examined, reported to be in a dangerous state, he resolved to steer
immediately for the Cape, as the most eligible place, both for the
recovery of his sick, and for procuring a new main-piece to the
rudder.
From the 21st of March, when we were in latitude 27° 22ʹ S.,
longitude 52° 25ʹ E., to the 5th of April, when we had got into
latitude 36° 12ʹ S., longitude 22° 7ʹ E., we were strongly affected by
the currents, which set to the south south-west, and south-west by
west, sometimes at the rate of eighty knots a day. On the 6th,
having got under the lee of the African coast, we lost them entirely.
In the morning of the 6th, a sail was seen to the south-west
standing toward us; and, as the wind soon after rose from the same
quarter, we cleared our ships for action. We now discovered, from
the mast-head, five sail more on our lee-bow, standing to the
eastward; but the weather coming on hazy, we lost sight of them all
in an hour’s time. Our latitude at noon was 35° 49ʹ S., longitude 21°
32ʹ E. At seven o’clock the next morning (the seventh), we made the
land to the northward at a considerable distance.
On the 8th, the weather was squally, and blew fresh from the
north-west; the following day it settled to the west, and we passed
pretty close to the sail seen on the 6th, but did not hail her. She was
clumsy in figure, and, to appearance, unskilfully managed; yet she
out-sailed us exceedingly. The colours which she hoisted were
different from any we had seen; some supposed them to be
Portugueze, others Imperial.
At day-light the next morning, the land again appeared to the
north north-west, and, in the forenoon, a snow was seen bearing
down to us, which proved to be an English East-India packet, that
had left Table Bay three days before, and was cruizing with orders
for the China fleet, and other India ships. She told us, that about
three weeks before, Mons. Trongoller’s squadron, consisting of six
ships, had sailed from the Cape, and was gone to cruize off St.
Helena, for our East-India fleet. This intelligence made us
conjecture, that the five sail we had seen standing to the eastward
must have been the French squadron, who, in that case, had given
over their cruize, and were probably proceeding to the Mauritius.
Having informed the packet of our conjectures, and also of the time
we understood the China ships were to sail from Canton, we left
them, and proceeded toward the Cape.
In the evening of the 10th, the Gunner’s Quoin bore north by east,
and False Cape east north-east; but the wind being at south-west,
and variable, prevented our getting into False Bay, till the evening of
the 12th, when we dropt anchor abreast of Simon’s Bay. We found a
strong current setting to the westward, round the Cape, which, for
some time, we could but just stem, with a breeze that would have
carried us four knots an hour. The next morning, we stood into
Simon’s Bay; and at eight came to anchor, and moored a cable each
way; the best bower to the east south-east, and small bower west
north-west; the south-east point of the bay bearing south by east,
Table Mountain north-east half north; distant from the nearest shore
one-third of a mile. We found lying here, the Nassau and
Southampton East-Indiamen, waiting for convoy for Europe. The
Resolution saluted the fort with eleven guns, and the same number
was returned.
Mr. Brandt, the governor of this place, came to visit us, as soon as
we had anchored. This gentleman had conceived a great affection
for Captain Cook, who had been his constant guest, the many times
he had visited the Cape; and though he had received the news of his
melancholy fate some time before, he was exceedingly affected at
the sight of our ships returning without their old commander. He
appeared much surprized to see our crew in so stout and healthy a
condition, as the Dutch ship that had left Macao on our arrival there,
and had touched at the Cape some time before, reported, that we
were in a most wretched state, having only fourteen hands left on
board the Resolution, and seven on board the Discovery. It is not
easy to conceive the motive these people could have had for
propagating so wanton and malicious a falsehood.
On the 15th, I accompanied Captain Gore to Cape Town; and the
next morning, we waited on Baron Plettenberg, the governor, by
whom we were received with every possible attention and civility. He
had also conceived a great personal affection for Captain Cook, as
well as the highest admiration of his character, and heard the recital
of his misfortune, with many expressions of unaffected sorrow. In
one of the principal apartments of the governor’s house, he shewed
us two pictures, of Van Tromp and De Ruyter, with a vacant space
left between them, which he said he meant to fill up with the
portrait of Captain Cook; and for that purpose, he requested our
assistance when we should arrive in England, in purchasing one for
him, at any price.
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like