100% found this document useful (1 vote)
23 views59 pages

Programming for Problem Solving- GTU 2018 - eBook PDF download

The document is an overview of the eBook 'Programming for Problem Solving' published by McGraw Hill Education, focusing on the C programming language. It includes details about the author, E Balagurusamy, and outlines the book's structure, which covers various programming concepts such as control structures, functions, pointers, and file management. Additionally, it provides links to download various related eBooks and emphasizes the importance of C in programming education.

Uploaded by

hibenpayormc
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
100% found this document useful (1 vote)
23 views59 pages

Programming for Problem Solving- GTU 2018 - eBook PDF download

The document is an overview of the eBook 'Programming for Problem Solving' published by McGraw Hill Education, focusing on the C programming language. It includes details about the author, E Balagurusamy, and outlines the book's structure, which covers various programming concepts such as control structures, functions, pointers, and file management. Additionally, it provides links to download various related eBooks and emphasizes the importance of C in programming education.

Uploaded by

hibenpayormc
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/ 59

Programming for Problem Solving- GTU 2018 -

eBook PDF install download

https://ebookluna.com/download/programming-for-problem-solving-
ebook-pdf/

Download more ebook from https://ebookluna.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

(eBook PDF) Programming, Problem Solving and Abstraction


with C

https://ebookluna.com/product/ebook-pdf-programming-problem-solving-
and-abstraction-with-c/

ebookluna.com

Problem Solving and Python Programming 1st edition - eBook


PDF

https://ebookluna.com/download/problem-solving-and-python-programming-
ebook-pdf/

ebookluna.com

Programming and Problem Solving with Python 1st Edition -


eBook PDF

https://ebookluna.com/download/programming-and-problem-solving-with-
python-ebook-pdf/

ebookluna.com

(eBook PDF) Java: An Introduction to Problem Solving and


Programming 7th Edition

https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-7th-edition/

ebookluna.com
(eBook PDF) Java: An Introduction to Problem Solving and
Programming 8th Edition

https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-
problem-solving-and-programming-8th-edition/

ebookluna.com

Mathematics-1, GTU–2018 - eBook PDF

https://ebookluna.com/download/mathematics-1-gtu-2018-ebook-pdf/

ebookluna.com

(eBook PDF) Matlab: A Practical Introduction to


Programming and Problem Solving 4th Edition

https://ebookluna.com/product/ebook-pdf-matlab-a-practical-
introduction-to-programming-and-problem-solving-4th-edition/

ebookluna.com

(eBook PDF) Introduction to Programming with Java: A


Problem Solving Approach 3rd Edition

https://ebookluna.com/product/ebook-pdf-introduction-to-programming-
with-java-a-problem-solving-approach-3rd-edition/

ebookluna.com

(eBook PDF) Community Policing: Partnerships for Problem


Solving 8th Edition

https://ebookluna.com/product/ebook-pdf-community-policing-
partnerships-for-problem-solving-8th-edition/

ebookluna.com
PROGRAMMING
fOR
PRObleM SOlvING
Gujarat Technological University - 2018
About the Author

E Balagurusamy, is presently the Chairman of EBG Foundation, Coimbatore. In the past he has also held
the positions of member, Union Public Service Commission, New Delhi and Vice-Chancellor, Anna University,
Chennai. 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, E-Governance:
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.
A recipient of numerous honors and awards, he has been listed in the Directory of Who's Who of Intellectuals
and in the Directory of Distinguished Leaders in Education.
PROGRAMMING
fOR
PRObleM SOlvING
Gujarat Technological University - 2018

E Balagurusamy
Chairman
EBG Foundation
Coimbatore

McGraw Hill Education (India) Private Limited


CHENNAI

McGraw Hill Education Offices


Chennai 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
444/1, Sri Ekambara Naickr Industrial Estate, Alapakkam, Porur, Chennai-600 116

Programming for Problem Solving


Copyright © 2019 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 listings (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.
Print Edition
ISBN (13 digit): 978-93-5316-278-8
ISBN (10 digit): 93-5316-278-5
E-book Edition
ISBN (13 digit): 978-93-5316-279-5
ISBN (10 digit): 93-5316-279-3
1 23456789 D101417 22 21 20 19 18
Printed and bound in India.
Director—Science & Engineering Portfolio: Vibha Mahajan
Senior Portfolio Manager—Science & Engineering: Hemant K Jha
Associate Portfolio Manager —Science & Engineering: Tushar Mishra
Production Head: Satinder S Baveja
Copy Editor: Taranpreet Kaur
Assistant Manager—Production: Suhaib Ali
General Manager—Production: Rajender P Ghansela
Manager—Production: 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 The Composers, 260, C.A. Apartment, Paschim Vihar, New Delhi 110 063 and printed at

Cover Printer:
Cover Designer: APS Compugraphics
Cover Image Source: Shutterstock
Visit us at: www.mheducation.co.in
Write to us at: info.india@mheducation.com
CIN: U22200TN1970PTC111531
Toll Free Number: 1800 103 5875
Preface

P
rogramming for Problem Solving requires a deep understanding of C. C is a powerful, flexible, portable
and elegantly structured programming language. Since C combines the features of high-level language
with the elements of the assembler, it is suitable for both systems and applications programming. It
is undoubtedly the most widely used general-purpose language today in operating systems, and embedded
system development. Its influence is evident in almost all modern programming languages. Since its
standardization in 1989, C has undergone a series of changes and improvements in order to enhance the
usefulness of the language.

Organization of the Book


Programming for Problem Solving starts with an Introduction to Computer Programming, Chapter 2 discusses
fundamentals of C. Control Structures in C is presented in Chapter 3. Chapter 4 deals with Arrays and
Strings. Chapter 5 discusses Functions. In Chapter 6 students can study Pointers. While Chapter 7 details
Structure. Dynamic Memory Allocation is discussed in Chapter 8. Chapter 9 details on File Management.

Salient Features of the Book


∑ Learning Objectives
∑ Key Concepts
∑ Content Tagged with LO
∑ Worked Out Problems
∑ Tips
∑ Closing Vignette
∑ Review Exercises – True False, Fill in the blanks, Questions, Programming Exercises – categorized into
LO and Difficulty level (E for Easy, M for Medium and H for High)

Acknowledgements
I owe special thanks to the entire team of McGraw Hill Education India.
A note of acknowledgement is due to the following reviewers for their valuable feedback.

Ms. Kalpana Mudaliar Gandhinagar Institute of Technology, Gandhinagar, Gujarat


H K Patnaik Kalinga Institute of Industrial Technology, KIIT University, Bhubaneswar
T V Gopal College of Engineering, Anna University, Chennai, Tamil Nadu
Unnati Nitin Chaudhari Tolani Maritime Institute, Pune, Maharashtra
Tanveer Ahmed Jamia Millia Islamia, Delhi
Ravindra Divekar KJ Somaiya College of Engineering, Mumbai, Maharashtra
SC Dutta Birsa Institute of Technology, Sindri, Dhanbad, Jharkhand
D Lakshmi Adithya Institute of Technology, Coimbatore, Tamil Nadu
vi Preface

This book is my sincere attempt to make a footprint on the immensely vast and infinite sands of knowledge.
I would request the readers to utilize this book to the maximum extent.
E Balagurusamy

Publisher’s Note
McGraw Hill Education (India) invites suggestions and comments from you, all of which can be sent to info.
india@mheducation.com (kindly mention the title and author name in the subject line).
Piracy-related issues may also be reported.
Contents

About the Author ii


Preface v

1. Introduction to Computer and Programming 1


Learning Objectives 1
Introduction 1
Generations of Computers 2
Classification of Computers 5
Basic Anatomy of a Computer System 7
Input Devices 8
Processor 9
Output Devices 10
Memory Management 12
Types of Computer Software 13
Overview of Operating System 14
MS Word 19
MS Excel System 21
MS Powerpoint System 22
Networking Concepts 23
Network Topologies 25
Network Protocols and Software 29
Decimal System 31
Binary System 32
Hexadecimal System 33
Octal System 34
Conversion of Numbers 35
Binary Arithmetic Operations 44
Logic Gates 52
Programming Languages 55
viii Contents

Translator Programs 58
Problem-Solving Techniques 59
Using the Computer 70
Learning Outcomes 70
Key Concepts 71
Review Questions 73
Discussion Questions 84

2. Fundamentals of C 87
Learning Objectives 87
History of C 87
Importance of C 89
Sample Program 1: Printing a Message 89
Sample Program 2: Adding Two Numbers 92
Sample Program 3: Interest Calculation 93
Sample Program 4: Use of Subroutines 95
Sample Program 5: Use of Math Functions 96
Basic Structure of C Programs 97
Programming Style 98
Executing a ‘C’ Program 99
UNIX System 99
MS-DOS System 102
Key Concepts 102
Always Remember 103
Review Questions 103
Debugging Exercises 105
Programming Exercises 105

3. Control Structure in C 107


Learning Objectives 107
Introduction 107
Decision Making with if Statement 108
Simple If Statement 108
The If.....Else Statement 111
Nesting of If....Else Statements 114
The Else If Ladder 117
The Switch Statement 121
The ? : Operator 125
The goto Statement 129
Key Concepts 132
Contents ix

Always Remember 132


Brief Cases 132
Review Questions 137
Debugging Exercises 141
Programming Exercises 141

4. Array & String 145


Learning Objectives 145
Introduction 145
One-Dimensional Arrays 147
Declaration of One-dimensional Arrays 148
Initialization of One-dimensional Arrays 151
Two-Dimensional Arrays 156
Initializing Two-dimensional Arrays 161
Multi-dimensional Arrays 168
Dynamic Arrays 169
More About Arrays 170
Declaring and Initializing String Variables 170
Reading Strings from Terminal 171
Writing Strings to Screen 177
Arithmetic Operations on Characters 181
Putting Strings Together 183
Comparison of Two Strings 184
String-Handling Functions 184
Table of Strings 190
Other Features of Strings 192
Key Concepts 192
Always Remember 193
Brief Cases 194
Review Questions 210
Debugging Exercises 214
Programming Exercises 215

5. Functions 220
Learning Objectives 220
Introduction 220
Need for User-Defined Functions 221
A Multi-Function Program 221
Elements of User-Defined Functions 224
x Contents

Definition of Functions 224


Return Values and Their Types 227
Function Calls 228
Function Declaration 229
Category of Functions 231
No Arguments and No Return Values 231
Arguments but No Return Values 233
Arguments with Return Values 236
No Arguments but Returns a Value 241
Functions that Return Multiple Values 242
Nesting of Functions 243
Recursion 244
Passing Arrays to Functions 245
Passing Strings to Functions 250
The Scope, Visibility and Lifetime of Variables 251
Multifile Programs 260
Key Concepts 262
Always Remember 262
Brief Cases 263
Review Questions 266
Debugging Exercises 270
Programming Exercises 270

6. Pointers 273
Learning Objectives 273
Introduction 273
Understanding Pointers 274
Accessing the Address of a Variable 276
Declaring Pointer Variables 277
Initialization of Pointer Variables 278
Accessing a Variable Through its Pointer 279
Chain of Pointers 281
Pointer Expressions 282
Pointer Increments and Scale Factor 284
Pointers and Arrays 284
Pointers and Character Strings 288
Array of Pointers 290
Pointers as Function Arguments 291
Functions Returning Pointers 294
Contents xi

Pointers to Functions 295


Pointers and Structures 297
Troubles with Pointers 299
Key Concepts 300
Always Remember 300
Brief Cases 301
Review Questions 306
Debugging Exercises 309
Programming Exercises 309

7. Structure 311
Learning Objectives 311
Introduction 311
Defining a Structure 312
Declaring Structure Variables 313
Accessing Structure Members 315
Structure Initialization 316
Copying and Comparing Structure Variables 318
Operations on Individual Members 320
Arrays of Structures 320
Arrays within Structures 323
Structures within Structures 324
Structures and Functions 326
Unions 329
Size of Structures 330
Bit Fields 330
Key Concepts 333
Always Remember 333
Brief Cases 334
Review Questions 338
Debugging Exercises 341
Programming Exercises 341

8. Dynamic Memory Allocation 344


Learning Objectives 344
Introduction 344
Dynamic Memory Allocation 344
Allocating a Block of Memory: malloc 345
Allocating Multiple Blocks of Memory: calloc 347
xii Contents

Releasing the Used Space: free 348


Altering the Size of a Block: realloc 348
Concepts of Linked Lists 350
Advantages of Linked Lists 353
Types of Linked Lists 354
Pointers Revisited 354
Creating a Linked List 356
Inserting an Item 360
Deleting an Item 363
Application of Linked Lists 365
Key Concepts 365
Always Remember 366
Brief Cases 366
Review Questions 372
Debugging Exercises 374
Programming Exercises 374

9. File Management 376


Learning Objectives 376
Introduction 376
Defining and Opening a File 377
Closing a File 378
Input/Output Operations on Files 379
Error Handling During I/O Operations 385
Random Access to Files 387
Command Line Arguments 394
Key Concepts 396
Always Remember 396
Review Questions 397
Debugging Exercises 398
Programming Exercises 398
Roadmap to the Syllabus
Programming For Problem Solving
Code: 3110003

Introduction to computer and programming: Introduction, Basic block diagram and functions of various
components of computer, Concepts of Hardware and software, Types of software, Compiler and interpreter,
Concepts of Machine level, Assembly level and high level programming, Flowcharts and Algorithms

GO TO Chapter 1 Introduction to Computer and Programming

Fundamentals of C: Features of C language, structure of C Program, comments, header files, data types,
constants and variables, operators, expressions, evaluation of expressions, type conversion, precedence
and associativity, I/O functions

GO TO Chapter 2 Fundamentals of C

Control structure in C: Simple statements, Decision making statements, Looping statements, Nesting of
control structures, break and continue, goto statement

GO TO Chapter 3 Control Structure in C

Array & String: Concepts of array, one and two dimensional arrays, declaration and initialization of arrays,
string, string storage, Built-in-string functions
Recursion: Recursion, as a different way of solving problems. Example programs, such as Finding
Factorial, Fibonacci series, Ackerman function etc. Quick sort or Merge sort.

GO TO Chapter 4 Array & String


xiv Roadmap to the Syllabus

Functions: Concepts of user defined functions, prototypes, definition of function, parameters, parameter
passing, calling a function, recursive function, Macros, Pre-processing

GO TO Chapter 5 Functions

Pointers: Basics of pointers, pointer to pointer, pointer and array, pointer to array, array to pointer, function
returning pointer

GO TO Chapter 6 Pointers

Structure: Basics of structure, structure members, accessing structure members, nested structures, array
of structures, structure and functions, structures and pointers

GO TO Chapter 7 Structure

Dynamic memory allocation: Introduction to Dynamic memory allocation, malloc, calloc

GO TO Chapter 8 Dynamic Memory Allocation

File management: Introduction to file management and its functions

GO TO Chapter 9 File Management


Introduction to
Chapter
Computer and
Programming 1
LEARNING OBJECTIVES
LO 1.1 Identify the various generations of computers
LO 1.2 Classify computers on the basis of different criteria
LO 1.3 Describe the computer system
LO 1.4 Classify various computer software
LO 1.5 Discuss various operating systems
LO 1.6 Discuss Microsoft software
LO 1.7 Know various networking concepts and protocols
LO 1.8 Identify the various positional number systems
LO 1.9 Carry out number conversions from one number system to another
LO 1.10 Explain how binary arithmetic operations are performed
LO 1.11 Describe primary logic gates
LO 1.12 Discuss various levels of programming languages
LO 1.13 Know various problem solving techniques and computer applications

introduction
A computer is an electronic machine that takes input from the user, processes the given input and generates
output in the form of useful information. A computer accepts input in different forms such as data, programs
and user reply. Data refer to the raw details that need to be processed to generate some useful information.
Programs refer to the set of instructions that can be executed by the computer in sequential or non-
sequential manner. User reply is the input provided by the user in response to a question asked by the
computer.
A computer includes various devices that function as an integrated system to perform several tasks
described above (Fig. 1.1). These devices are:
Central Processing Unit (CPU)
It is the processor of the computer that is responsible for controlling and executing instructions in the computer.
It is considered as the most significant component of the computer.
2 Programming for Problem Solving

Monitor
It is a screen, which displays information in visual form, after receiving the video signals from the computer.
Keyboard and Mouse
These are the devices, which are used by the computer, for receiving input from the user.

Fig. 1.1 The components of computer

Computers store and process numbers, letters and words that are often referred to as data.
l How do we communicate data to computers?
l How do the computers store and process data?
Since the computers cannot understand the Arabic numerals or the English alphabets, we should use
some ‘codes’ that can be easily understood by them.
In all modern computers, storage and processing units are made of a set of silicon chips, each contain-
ing a large number of transistors. A transistor is a two-state device that can be put ‘off’ and ‘on’ by passing
an electric current through it. Since the transistors are sensitive to currents and act like switches, we can
communicate with the computers using electric signals, which are represented as a series of ‘pulse’ and
‘no-pulse’ conditions. For the sake of convenience and ease of use, a pulse is represented by the code ‘1’
and a no-pulse by the code ‘0’. They are called bits, an abbreviation of ‘binary digits’. A series of 1s and
0s are used to represent a number or a character and thus they provide a way for humans and computers
to communicate with one another. This idea was suggested by John Von Neumann in 1946. The numbers
represented by binary digits are known as binary numbers. Computers not only store numbers but also
perform operations on them in binary form.
In this chapter, we discuss how the numbers are represented using what are known as binary codes, how
computers perform arithmetic operations using the binary representation, how digital circuits known as logic
gates are used to manipulate data, how instructions are designed using what are known as programming
languages and how algorithms and flow charts might help us in developing programs.

generations of computers
The history of computer development is often discussed in terms of different LO 1.1
generation of computers, as listed below. Identify the various
l First generation computers generations
l Second generation computers of computers
l Third generation computers
l Fourth generation computers
l Fifth generation computers
Introduction to Computer and Programming 3

These computers used the vacuum tubes


technology (Fig. 1.2) for calculation as well as
for storage and control purposes. Therefore,
these computers were also known as vacuum
tubes or thermionic valves based machines.
Some examples of first generation computers
are ENIAC, EDVAC, EDSAC and UNIVAC.
Advantages
l Fastest computing devices of their time.
l Able to execute complex mathematical
problems in an efficient manner.
Disadvantages
l These computers were not very easy to
program being machine dependent.
l They were not very flexible in running
different types of applications as designed
for special purposes.
l The use of vacuum tube technology made
these computers very large and bulky and
also required to be placed in cool places.
l They could execute only one program at a
time and hence, were not very productive.
l They generated huge amount of heat and
hence were prone to hardware faults.
Fig. 1.2 A vacuum tube

These computers use transistors in place of vacuum tubes in building


the basic logic circuits. A transistor is a semiconductor device that is
used to increase the power of the incoming signals by preserving the
shape of the original signal (Fig. 1.3).
Some examples of second generation computers are PDP-8, IBM
1401 and IBM 7090.
Advantages
l Fastest computing devices of their time.
l Easy to program because of the use of assembly language.
l Small and light weight computing devices.
l Required very less power in carrying out operations.
Disadvantages
l Input and output media for these computers were not improved
to a considerable extent.
l Required to be placed in air-conditioned places. Fig. 1.3 A transistor
4 Programming for Problem Solving

l Very expensive and beyond the reach of home users.


l Being special-purpose computers they could execute only specific applications.

The major characteristic feature of third generation


computer systems was the use of Integrated Circuits
(ICs). ICs are the circuits that combine various electronic
components, such as transistors, resistors, capacitors, etc.
onto a single small silicon chip.
Some examples of third generation computers are NCR
395, B6500, IBM 370, PDP 11 and CDC 7600.
Advantages
l Computational time for these computers was usually
in nanoseconds hence were the fastest computing
devices
l Easily transportable because of their small size.
l They used high-level languages which is machine
independent hence very easy to use. Fig. 1.4 An integrated circuit
l Easily installed and required less space.
l Being able to execute any type of application (business and scientific) these were considered as
general-purpose computers.
Disadvantages
l Very less storage capacity.
l Degraded performance while executing complex computations because of the small storage capacity.
l Very expensive.

The progress in LSI and VLSI technologies led to the development of microprocessor, which became the
major characteristic feature of the fourth generation
computers. The LSI and VLSI technology allowed
thousands of transistors to be fitted onto one small silicon
chip.
A microprocessor incorporates various components
of a computer—such as CPU, memory and Input/Output
(I/O) controls—onto a single chip. Some popular later
microprocessors include Intel 386, Intel 486 and Pentium.
Some of the examples of fourth generation computers
are IBM PC, IBM PC/AT, Apple and CRAY-1.
Advantages
l LSI and VLSI technologies made them small,
cheap, compact and powerful.
l high storage capacity
l highly reliable and required very less maintenance. Fig. 1.5 The Intel P4004 microprocessor chip
Introduction to Computer and Programming 5

l provided a user-friendly environment with the development of GUIs and interactive I/O devices.
l programs written on these computers were highly portable because of the use of high-level languages.
l very versatile and suitable for every type of applications.
l required very less power to operate.
Disadvantages
l the soldering of LSI and VLSI chips on the wiring board was complicated
l still dependent on the instructions given by the programmer.

Fifth generation computers are based on the Ultra Large Scale Integration (ULSI) technology that allows
almost ten million electronic components to be fabricated on one small chip.
Advantages
l faster, cheaper and most efficient computers till date.
l They are able to execute a large number of applications at the same time and that too at a very high
speed.
l The use of ULSI technology helps in decreasing the size of these computers to a large extent.
l very comfortable to use because of the several additional multimedia features.
l versatile for communications and resource sharing.
Disadvantage
They are not provided with an intelligent program that could guide them in performing different operations.
Figure 1.6 shows a tree of computer family that illustrates the area-wise developments during the last
four decades and their contributions to the various generations of computers.

classification of computers
Computers can be classified into several categories depending on their LO 1.2
computing ability and processing speed. These include Classify computers on
l Microcomputer the basis of different
l Minicomputer criteria
l Mainframe computers
l Supercomputers
Microcomputers
A microcomputer is defined as a computer that has a microprocessor as its CPU and can perform the
following basic operations:
l Inputting — entering data and instructions into the microcomputer system.
l Storing — saving data and instructions in the memory of the microcomputer system, so that they can
be use whenever required.
l Processing — performing arithmetic or logical operations on data, where data, such as addition,
subtraction, multiplication and division.
l Outputting — It provides the results to the user, which could be in the form of visual display and/or
printed reports.
l Controlling — It helps in directing the sequence and manner in which all the above operations are
performed.
Minicomputers
A minicomputer is a medium-sized computer that is more powerful than a microcomputer. It is usually
designed to serve multiple users simultaneously, hence called a multiterminal, time-sharing system.
6 Programming for Problem Solving

Fig. 1.6 Tree of computer family


Introduction to Computer and Programming 7

Minicomputers are popular among research and business organizations today. They are more expensive
than microcomputers.
Mainframe Computers
Mainframe computers help in handling the information processing of various organizations like banks,
insurance companies, hospitals and railways. Mainframe computers are placed on a central location and
are connected to several user terminals, which can act as access stations and may be located in the same
building. Mainframe computers are larger and expensive in comparison to the workstations.
Supercomputers
In supercomputers, multiprocessing and parallel processing technologies are used to promptly solve
complex problems. Here, the multiprocessor can enable the user to divide a complex problem into smaller
problems. A supercomputer also supports multiprogramming where multiple users can access the computer
simultaneously. Presently, some of the popular manufacturers of supercomputers are IBM, Silicon Graphics,
Fujitsu, and Intel.

Basic anatomy of a computer system


A computer system comprises 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:
l 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.

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.7 Interaction among hardware components
8 Programming for Problem Solving

l 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.
l 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.
l 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 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 (operating
system and networking system) is mandatory for running application software.

input DeVices
LO 1.3
Input devices are electromechanical devices that are used to provide data
Describe the computer
to a computer for storing and further processing, if necessary. Depending
system
upon the type or method of input, the input device may belong to one of the
following categories:

Keyboard is used to type data and text and execute commands. A standard keyboard, as shown in Fig. 1.8,
consists of the following groups of keys:

Fig. 1.8 The presently used keyboard


Alphanumeric Keys include the number keys and alphabet keys arranged in QWERTY layout.
Function Keys help perform specific tasks, such as searching a file or refreshing a web page.
Central Keys include arrow keys (for moving the cursor) and modifier keys such as SHIFT, ALT and CTRL
(for modifying the input).
Introduction to Computer and Programming 9

Numeric Keypad looks like a calculator’s keypad with its 10 digits and mathematical operators.
Special Purpose Keys The special purpose keys help perform a certain kind of operation, like exiting a
program (Escape) or deleting some characters (Delete) in a document, etc.

Mouse is a small hand-held pointing device that basically controls the two-dimensional movement of the
cursor on the displayed screen. It is an important part of the Graphical User Interface (GUI) based Operating
Systems (OS) as it helps in selecting a portion of the screen and copying and pasting the text.
The mouse, on moving, also moves the pointer appearing on the display device (Fig. 1.9).
Wheel
Right Button
Left Button

Fig. 1.9 A mechanical mouse

Scanning devices are the input devices that can electronically


capture text and images, and convert them into computer readable
form (Fig. 1.10).
There are the following types of scanners that can be used to
produce digitized images:
l 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.
l Drum scanner — In this type of scanner, a fixed scanner
head is used and the image to be scanned is moved across Fig. 1.10 A Scanner
the head. The drum scanners are used for scanning prepress
materials.
l Slide scanner — It is a scanner that can scan photographic slides directly to produce files
understandable by the computer.
l 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.

processor
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
10 Programming for Problem Solving

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:
l 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.
l 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.
l Microprocessor: CPU component that performs the processing and controls the activities performed
by the different parts of the computer.
l ROM: Chip that contains the permanent memory of the computer that stores information, which cannot
be modified by the end user.
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. A sound card is
a circuit board placed on the motherboard and is used to enhance the sound capabilities of a computer.

output DeVices
The main task of an output device is to convert the machine-readable information into human-readable form
which may be in the form of text, graphics, audio or video.

A monitor produces visual displays generated by the computer. The monitor is connected to the video card
placed on the expansion slot of the motherboard.

Fig. 1.11 A CRT monitor and the internal components of a CRT


Introduction to Computer and Programming 11

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 lesser space. Both the monitors are available as monochrome, gray scale and
color models.
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
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.

The printer is an output device that transfers the text displayed on the screen, onto paper sheets that can
be used by the end user. Printers can be classified based on the technology they use to print the text and
images:
l Dot matrix printers — Dot matrix printers are impact printers that use perforated sheet to print the
text. Dot matrix printers are used to produce multiple copies of a print out.
l Inkjet printers — Inkjet printers are slower than dot matrix printers and are used to generate high
quality photographic prints.
l 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.

These systems record the simple messages in human speech form and then combine all these simple
messages to form a single message. The voice response system is of two types—one uses a reproduction
of human voice and other sounds, and the other uses speech synthesis.
The basic application of a voice output system is in Interactive Voice Response (IVR) systems, which are
used by the customer care or customer support departments of an organization, such as telecommunication
companies, etc.

A projector is a device that is connected to a


computer or a video device for projecting an
image from the computer or video device onto
the big white screen. The images projected
by a projector are larger in size as compared
to the original images. A projector consists of
an optic system, a light source and displays,
which contain the original images. Projectors
were initially used for showing films but now
they are used on a large scale for displaying
presentations in business organizations and for
viewing movies at home. Fig. 1.12 A portable projector
Other documents randomly have
different content
anything to occupy me. Darling Rhadampsicus, you must talk to me
sometimes!"
He talked to her absorbedly. He seemed to think, however, that
discussion of the local solar phenomena was conversation. With
feminine guile, she pretended to be satisfied, but presently she went
back to her housekeeping. She began to dream of their life when
they had returned home, and of the residence they would inhabit
there. Presently she was planning the parties she would give as a
young matron, with canapés of krypton snow and zenon ice, with
sprinklings of lovely red nickel bromide crystals for a garnish—

The sun rose again, and they lived. It was as if the sky were covered
with a thick cloud bank which absorbed the monstrous radiation of a
sun now four times its previous diameter and madly changing shape
like a monstrous ameba of flame.
In time the sun set. It rose again. It set. And Cetis Gamma Two
remained a living planet instead of being a scorched cinder.
When four days had gone by and nobody died, the colonists decided
that they might actually keep on living. They had at first no
especially logical foundation for their belief.
But Cathy boasted. And she boasted in Cetopolis. Since they were
going to keep on living, the conventions required that she return to
the planet's one human settlement and her duties as a beamphone
operator. It wasn't proper for her to stay unchaperoned so long as
she and Lon weren't married yet.
She had no difficulty with Carson. He didn't refer to her desertion.
Carson had his own troubles. Now that he had decided that he
would live, his problems multiplied. The colonists' barns were filled
to capacity with thanar leaves which would pay off their debts to the
Company. He began to worry about that.
Lost without the constant directives from the Company, he had his
technicians step up the power in the settlement transmitter. He knew
that the screen Lon had put up would stop ordinary spacegram
transmission. Even with a tight beam, he could broadcast and
receive only at night, when the screen was thinnest. Even so, he had
to search out holes in the screen.
The system didn't work perfectly—it wasn't two-way at all, until the
Company stepped up the power in its own transmitter—but
spacegrams started to get through again.
Carson smiled in relief. He began to regain some of his old
arrogantly bored manner. Now that the Company's guiding hand was
once more with him, nothing seemed as bad as it had been. He was
able to report that something had happened to save the colony from
extinction, and that Lon Simpson had probably done it.
In return, he got a spacegram demanding full particulars, and
precise information on the devices he had reported Lon Simpson to
have made.
Humbly, Carson obeyed his corporation.

He pumped Cathy—which was not difficult, because she was


bursting with pride in Lon. She confirmed, in detail, the rumor that
Lon was somehow responsible for the protective screen that was
keeping everybody alive.
Carson sent the information by spacegram. He was informed that a
special Company ship was heading for Cetis Gamma Two at full
speed. Carson would take orders from its skipper when it arrived.
Meanwhile, he would buy thanar leaf if absolutely necessary, but
stall as long as possible. The legal staff of the Trading Company was
working on the problem of adapting the system to get the new
surplus supplies of thanar without letting anybody get anything in
particular for it. He would keep secret the coming of the special ship,
which was actually the space yacht of a member of the Board of
Directors. And he would display great friendliness toward Lon
Simpson.
The last was the difficult part, because Lon Simpson was becoming
difficult. With the sun writhing as if in agony overhead—seen dimly
through a permanent blessed mistiness—and changing shape from
hour to hour, Lon Simpson had discovered something new to get
mad about. Lon had felt definitely on top of the world. He had
solved the problem of clearing his debts and getting credit sufficient
for two passages back to Earth, with money there to take care of
getting rich on his inventions. There was no reason to delay
marriage. He wanted to get married. And through a deplorable
oversight, there had been no method devised by which a legal
marriage ceremony could be performed on Cetis Gamma Two.
It was one of those accidental omissions which would presently be
rectified. But the legal minds who'd set up the system for the planet
had been thinking of money, not marriages. They hadn't envisioned
connubial bliss as a service the Company should provide. And Lon
was raising cain. His barn was literally bursting with thanar leaves,
and he was filling up his attic, extra bedroom, living quarters and
kitchen with more. He was rich. He wanted to get married. And it
wasn't possible.
Lon was in a position to raise much more cain than ordinary. He'd
made an amicable bargain with his fellow colonists. They brought
truckloads of miscellaneous foliage to be put into his vegetation
converter, and he converted it all into thanar leaves. The product
was split two ways. Everybody was happy—except Carson—Because
every colonist had already acquired enough thanar leaf to pay
himself out of debt, and was working on extra capital.
If this kept up, the galactic market would be broken.
Carson had nightmares about that.
So the sun went through convulsions in emptiness, and nobody on
its second planet paid any attention at all. After about a week, it
occasionally subsided. When that happened, the ionization of the
planet's upper atmosphere lessened, the radiation screen grew
thinner, and a larger proportion of light reached the surface. When
the sun flared higher, the shield automatically grew thicker. An
astronomical phenomenon which should have destroyed all life on
the inner planets came to be taken for granted.
But events on the second planet were not without consequences
elsewhere. The Board of Directors of the Cetis Gamma Trading
Company simultaneously jittered and beamed with anticipation. If
Lon could convert one form of vegetable product into another, then
the Company's monopoly of thanar would vanish as soon as he got
loose with his device. On the other hand, if the Company could get
that device for its very own....
Thanar had a practically unlimited market. Every year a new age
group of the population needed a milligram a day to keep old age
away. But besides that, there was Martian zuss fiber, which couldn't
be marketed because there wasn't enough of it, but would easily
fetch a thousand credits a kilo if Lon's gadget could produce it from
samples. There was that Arcturian sicces dust—the pollen of an
inordinately rare plant on Arcturus Four—which could be sold at
more than its weight in diamonds, for perfume. And—
The directors of the Company shivered over what might happen; and
gloated over what could. So they kept their fingers crossed while the
space yacht of one of their number sped toward Cetis Gamma Two,
manned by very trustworthy men who would carry out their
instructions with care and vigor and no nonsense about it.
Lon Simpson worked with his neighbors, converting all sorts of
vegetable debris—the fact that some of it was scorched did not
seem to matter—into thanar leaf which was sound legal tender on
that particular planet. From time to time he went to Cetopolis. He
talked sentimentally and yearningly to Cathy. And then he went to
Carson's office and raised the very devil because there was as yet no
arrangement by which he and Cathy could enter into the state of
holy matrimony.

Rhadampsicus looked over his notes and was very well pleased. He
explained to Nodalictha that from now on the return of Cetis Gamma
to its normal condition would be a cut-and-dried affair. He would like
to stay and watch it, but the important phenomena were all over
now. He said solicitously that if she wanted to go on, completing
their nuptial journey.... She might be anxious to see her family and
friends.... She might be lonely....
Nodalictha smiled at him. The process would have been horrifying to
a human who watched, but Rhadampsicus smiled back.
"Lonely?" asked Nodalictha coyly. "With you, Rhadampsicus?"
He impulsively twined his eye stalks about hers. A little later he was
saying tenderly, "Then I'll just finish my observations, darling, and
we'll go on—since you don't mind waiting."
"I'd like to see my pets again," said Nodalictha, nestling comfortably
against him.
Together, they scanned the second planet, but their thoughts could
not penetrate its Rhinthak screen. They saw the space yacht flash up
to it. Rhadampsicus inspected the minds of the bipeds inside it.
Nodalictha, of course, modestly refrained from entering the minds of
male creatures other than her husband.
"Peculiar," commented Rhadampsicus. "Very peculiar. If I were a
sociologist, I might find it less baffling. But they must have a very
queer sort of social system. They actually intend to harm your pets,
Nodalictha, because the male now knows how to supply them all
with food and energy! Isn't that strange? I wish the Rhinthak screen
did not block off scanning.... But it will fade, presently."
"You will keep the others from harming my pets," said Nodalictha
confidently. "Do you know, darling, I think I must be quite the
luckiest person in the Galaxy, to be married to you."

The space yacht landed at the field outside Cetopolis. Inhabitants of


the tiny town flocked to the field to see new faces. They were
disappointed. One man came out and the airlock closed. No visitors.
The skipper went into Carson's office. He closed the door firmly
behind him. He had very beady eyes and a very hard-boiled
expression. He looked at Carson with open contempt, and Carson
felt that it was because Carson did the Company's dirty work with
figures and due regard for law and order, instead of frankly and
violently and without shilly-shallying.
"This Lon Simpson's got those gadgets, eh?" asked the skipper.
"Why—yes," said Carson unhappily. "He's very popular at the
moment. He made something on his barn roof that kept the sun
from burning us all to death, you know—that still keeps us from
burning to death, for that matter."
"So if we take it away or smash it," observed the skipper, "we don't
have to worry about anybody saying nasty things about us
afterward. Yeah?"
Carson swallowed.
"Everybody'd die if you smashed the gadget," he admitted, "but all
the thanar plants in existence would be burned up, too. There'd be
no more thanar. The Company wouldn't like that."
The skipper waved his hand. "How do I get this Simpson on my
ship? Take a bunch of my men and go grab him?"
"Wh-what are you going to do with him?"
"Don't you worry," said the skipper comfortingly. "We know how to
handle it. He knows how to make some things the bosses want to
know how to make. Once I get him on the ship, he'll tell. We got
ways. Do I take some men and grab him, or will you get him on
board peaceable?"
"There—ah—" Carson licked his lips. "He wants to get married.
There's no provision in the legal code for it, as yet. It was
overlooked. But I can tell him that as a ship captain, you—"
The skipper nodded matter of factly.
"Right. You get him and the girl on board. And I've got some orders
for you. Gather up plenty of thanar seed. Get some starting trays
with young plants in them. I'll come back in a couple of days and
take you and them on board. The stuff this guy has got is too good,
understand?"
"N-no. I'm afraid I don't."

"I get this guy to tell us how to make his gadgets," the skipper
explained contemptuously. "We make sure he tells us right. To be
extra sure, we leave the gadgets he's got made and working back
here, where he can't get to 'em and spoil 'em. But when we know all
he knows—and what he only guesses, too, and my tame scientists
have made the same kinda gadgets, an' they work—why, we come
back and pick you up, and the thanar seed and the young growing
plants. Then we get the gadgets this guy made here, and we head
back for Earth."
"But if you take the gadget that keeps us all from being burned up
—" Carson said agitatedly, "if you do, everybody here—"
"Won't that be too bad!" the skipper said ironically. "But you won't
be here. You'll be on the yacht. Don't worry. Now go fix it for the girl
and him to walk into our parlor."
Carson's hand shook as he reached for the beamphone. His voice
was not quite normal as he explained to Cathy in the exchange that
the skipper of the space yacht had the legal power to perform
marriage ceremonies in space. And Carson, as a gesture of
friendship to one of the most prominent colonists, had asked if the
captain would oblige Cathy and Lon. The captain had agreed. If they
made haste, he would take them out in space and marry them.
The skipper of the space yacht regarded him with undisguised scorn
when he hung up the phone and mopped his face.
"Pretty girl, eh?" he asked contemptuously, "and you didn't have the
nerve to grab her for yourself?" He did not wait for an answer. "I'll
look her over. You get your stuff ready for when I come back in a
couple of days."
"But—when you release them," Carson said shakily, "They'll report—"
The skipper looked at Carson without any expression at all. Then he
went out.
Carson felt sick. But he was a very loyal employee of the Cetis
Gamma Trading Company. From the windows of his air-conditioned
office, he watched Lon Simpson greet Cathy on his arrival in
Cetopolis. He saw Cathy put a sprig of chanel blossoms on the lapel
of her very best suit, in lieu of a bridal bouquet. And he watched
them go with shining faces toward the airport. He didn't try to stop
them.
Later he heard the space yacht take off.

Nodalictha prepared to share the thoughts and the happiness of the


female biped whose emotions were familiar, since Nodalictha was so
recently a bride herself. Rhadampsicus was making notes, but he
gallantly ceased when Nodalictha called to him. They sat, then,
before their crude but comfortable bower on the ninth planet, all set
to share the quaint rejoicing of the creatures of which Nodalictha
had grown fond.
Nodalictha penetrated the thoughts of the female, in pleased
anticipation. Rhadampsicus scanned the mind of the male, and his
expression changed. He shifted his thought to another and another
of the bipeds in the ship's company. He spoke with some distaste.
"The ones you consider your pets, Nodalictha, are amiable enough.
But the others—" He frowned. "Really, darling, if you went into their
minds, you'd be most displeased. They are quite repulsive. Let's
forget about them and start for home. If you really care for pets,
we've much more suitable creatures there."
Nodalictha pouted.
"Rhadampsicus, let's just watch their marriage ceremony. It is so
cute to think of little creatures like that loving each other—and
marrying—"
Rhadampsicus withdrew his thought from the space yacht and
looked about the charming rural retreat he and Nodalictha had
occupied. Its nitrogen-snow walls glittered in the starlight. The
garden of cyanogen flowers and the border of ammonia crystals and
the walkway of monoclinic sulphur, and the reflection pool of liquid
hydrogen he'd installed in an odd half hour. These were simple, but
they were delightful. The crudity of the space yacht with its metal
walls so curiously covered over with a coating of lead oxide in
hardened oil, and the vegetable gum flooring.... Rhadampsicus did
not like the surroundings men made for themselves in space.
"Very well, darling," he said resignedly. "We will watch, and then
we'll take off for home. I'm anxious to see what the modernists have
to say when I show them my notes on this flare-up.—And of course,"
he added with grave humor, "you want to show your family that I
haven't ill-treated you."
He was the barest trace impatient, but Nodalictha's thoughts were
with the female biped in the spaceship. Her expression was
distressed.
"Rhadampsicus!" she said angrily. "The other bipeds are being
unkind to my pets! Do something! I don't like them!"

A sailor in a soiled uniform led them into the space yacht's saloon.
The airlock clanked shut, and the yacht soared for the skies. The
sailor vanished. Nobody else came near. Then Lon stiffened. He got
the flavor of his surroundings. He had Cathy with him. On her
account, his flesh crawled suddenly.
This was a space yacht, but of a very special kind. It was a pleasure
ship. The decorations were subtly disgusting. There were pictures on
the walls, and at first glance they were pretty enough, but on
second glance they were disquieting, and when carefully examined
they were elaborately and allusively monstrous. This was the yacht
of someone denying that anything could be more desirable than
pleasure—and who took his pleasure in a most unattractive fashion.
Lon grasped this much, and it occurred to him that the crew of such
a yacht would be chosen for its willingness to coöperate in its
owner's enterprises. And Lon went somewhat pale, for Cathy was
with him.
The ship went up and up, with the dark shutters over the ports
showing that it was in sunshine fierce enough to be dangerous on
unshielded flesh. Presently there was the feel of maneuvering. After
a time the shutters flipped open and stars were visible.
Lon went quickly to a port and looked out. The great black mass of
the night side of Cetis Gamma Two filled half the firmament. It
blotted out the sun. The space yacht might be two or three
thousand miles up and in the planet's umbra—its shadow—which
was not necessary for a space wedding, or for anything involving a
reasonably brief stay in the excessive heat Cetis Gamma gave off.
There were clankings. A door opened. The skipper came in and
Cathy smiled at him because she didn't realize Lon's fierce
apprehension. Four other men followed, all in soiled and untidy
space yacht uniforms, then two other men in more ordinary clothing.
Their expressions were distinctly uneasy.
The four sailors walked matter of factly over to Lon and grabbed at
him. They should have taken him completely by surprise, but he had
been warned just enough to explode into battle. It was a very pretty
fight, for a time. Lon kept three of them busy. One snarled with a
wrenched wrist, another spat blood and teeth and a third had a
closed eye before the fourth swung a chair. Then Lon hit something
with his head. It was the deck, but he didn't know it.

When he came to, he was hobbled. He was not bound so he couldn't


move, but his hands were handcuffed together, with six inches of
chain between for play. His ankles were similarly restricted. He could
move, but he could not fight. Blood was trickling down his temple
and somebody was holding his head up.
The skipper said impatiently, "All right, stand back."
Lon's head was released. The skipper jerked a thumb. Men went out.
Lon looked about desperately for Cathy. She was there—dead white
and terrified, but apparently unharmed. She stared at Lon in
wordless pleading.
"You're a suspicious guy, aren't you?" asked the skipper sardonically.
"Somebody lays a finger on you and you start fighting. But you've
got the idea. I'll say it plain so we can get moving. You're Lon
Simpson. Carson, down on the planet, reported some nice news
about you. You made a gadget that converts any sort of leaf to
thanar. Maybe it turns stuff to other stuff, too." He paused. "We
want to know how to make gadgets like that. You're gonna draw
plans an' explain the theory. I got guys here to listen. We're gonna
make one, from your plans an' explanations, an' it'd better work.
See?"
"Carson sent for you to do this," Lon Simpson said thickly.
"He did. The Company wants it. They'll use it to make zuss fiber and
sicces dust, and stuff like that. Maybe dream dust, too, an' so on.
The point is you're gonna tell us how to make those gadgets. How
about it?"
Lon licked his lips. He said slowly, "I think there's more. Go on."
"You made another gadget," said the skipper, with relish, "that turns
out power without fuel. The Company wants that, too. Spacelines
will pay for it. Cities will pay for it. It ought to be a pretty nice thing.
You're gonna make plans and explanations of how that works and
we're gonna make sure they're right. That clear?"
"Will you let us go when I've told you?" Lon asked bitterly.
"Not without one more gadget," the skipper added amiably. "You
made something that put a screen around the planet yonder, so it
didn't get burned up. It'd oughta be useful. The company'll put one
around Mercury. Convenient for minin' operations. One around that
planet that's too close to Sirius. Oh, there's plenty of places that'll be
useful. So you'll get set to draw up the plans for that, too—and
explanations of how it works. Then we'll talk about lettin' you go."

Lon knew that he wouldn't be let go in any case. Not after he'd told
them what was wanted. Not by men who'd work on a pleasure craft
like this. Not with Cathy a prisoner with him. But he might as well
get all the cards down.
"And if I won't tell you what you want to know?" he asked.
The skipper shrugged his shoulders. "You were knocked out a
while," he said without heat. "While we were waitin' for you to come
to, we told her—" he jerked his thumb at Cathy—"what would
happen to her if you weren't obligin'. We told her plenty. She knows
we mean it. We won't hurt you until we've finished with her. So
you'd better get set to talk. I'll let her see if she can persuade you
peaceable. I'll give her ten minutes."
He went out. The door clicked shut behind him and Lon knew that
this was the finish. He looked at Cathy's dazed, horror-filled eyes. He
knew this wasn't a bluff. He was up against the same system that
had brought colonists to Cetis Gamma Two. The brains that had
planned that system had planned this. They'd gotten completely
qualified men to do their dirty work in both cases.
"Lon, darling! Please kill me!" Cathy said in a hoarse whisper.
He looked at her in astonishment.
"Please kill me!" repeated Cathy desperately. "They—they can't ever
dare let us go, Lon, after what they've told me! They've got to kill us
both. But—Lon, darling—please kill me first...."
An idea came into Lon's mind. He surveyed it worriedly. He knew
that he would have to tell what he knew and then he would be
killed. The Cetis Gamma Trading Company wanted his inventions,
and it would need him dead after it had them.
The idea was hopeless, but he had to try it. They knew he'd made
gadgets which did remarkable things. If he made something now
and persuaded them that it was a weapon....
His flesh crawled with horror. Not for himself, but for Cathy. He
fumbled in his pockets. A pocket knife. A key chain. String. His face
was completely gray. He ripped an upholstered seat. There were
coiled springs under the foamite. He pulled away a piece of
decorative molding. He knew it wouldn't work, but there wasn't
anything else to do. His hands moved awkwardly, with the handcuffs
limiting their movements.
Time passed. He had something finished. It was a bit of wood with a
coil spring from the chair, with his key chain wrapped around it and
his pocket knife set in it so that the blade would seem to make a
contact. But it would achieve nothing whatever.
Cathy stared at him. Her eyes were desperate, but she believed.
She'd seen three equally improbable devices perform wonders. While
Lon made something that looked like the nightmare of an ultimatist
sculptor, she watched in terrified hope.

He had it in his hand when the door opened again and the skipper
came back into the saloon. He said prosaically, "Shall I call in the
scientist guys to listen, or the persuader guys to work on her?"
"Neither. I've made another gadget," Lon said from a dry throat. "It
will kill you. It'll kill everybody on the ship—from here. You're going
to put us back down on the planet below."
The skipper did not look at the gadget, but at Lon's face. Then he
called. The four men of the crew and the two uneasy scientists came
in.
"We got to persuade," the skipper said sardonically. "He just told me
he's made a new gadget that'll kill us all."
He moved unhurriedly toward Lon. Lon knew that his bluff was no
good. If the thing had actually been a weapon, he'd have been
confident and assured. He didn't feel that way, but he raised the
thing menacingly as the skipper approached.
The skipper took it away, laughing.
"We'll tie him in a chair an' get to work on her. When he's ready to
talk, we'll stop." He looked at the object in his hands. It was
ridiculous to look at. It was as absurd as the device that extracted
power from matter stresses, and the machine that converted one
kind of vegetation into another, and the apparatus—partly barn roof
—that had short-circuited the ionosphere of Cetis Gamma Two to the
planet's solid surface. It looked very foolish indeed.
The skipper was amused.
"Look out, you fellas," he said humorously. "It's gonna kill you!"
He crooked his finger and the knifeblade made a contact. He swept
it in mock menace about the saloon. The four crew-members and
the two scientists went stiff. He gaped at them, then turned the
device to stare at it incredulously. He came within its range.
He stiffened. Off-balance, he fell on the device, breaking its gimcrack
fastenings and the contact which transmitted nothing that Lon
Simpson could imagine coming out of it. The others fell, one by one,
with peculiarly solid impacts.
Their flesh was incredibly hard. It was as solid, in fact, as so much
mahogany.

Nodalictha said warmly, "You're a darling, Rhadampsicus! It was


outrageous of those nasty creatures to intend to harm my pets! I'm
glad you attended to them!"
"And I'm glad you're pleased, my dear," Rhadampsicus said
pleasantly. "Now shall we set out for home?"
Nodalictha looked about the cosy landscape of the ninth planet of
Cetis Gamma. There were jagged peaks of frozen air, and mountain
ranges of water, solidified ten thousand aeons ago. There were frost-
trees of nitrogen, the elaborate crystal formations of argon, and here
a wide sweep of oxygen crystal sward, with tiny peeping wild
crystals of deep-blue cyanogen seeming to grow more thickly by the
brook of liquid hydrogen. And there was their bower; primitive, but
the scene of a true honeymoon idyll.
"I almost hate to go home, Rhadampsicus," Nodalictha said. "We've
been so happy here. Will you remember it for always?"
"Naturally," said Rhadampsicus. "I'm glad you've been happy."
Nodalictha snuggled up to him and twined eye stalks with him.
"Darling," she said softly, "you've been wonderful, and I've been
spoiled, and you've let me be. But I'm going to be a very dutiful wife
from now on, Rhadampsicus. Only it has been fun, having you be so
nice to me!"
"It's been fun for me, too," replied Rhadampsicus gallantly.
Nodalictha took a last glance around, and each of her sixteen eyes
glowed sentimentally. Then she scanned the far-distant spaceship in
the shadow of the second planet from the now subsiding sun.
"My pets," she said tenderly. "But—Rhadampsicus, what are they
doing?"
"They've discovered that the crew of their vehicle—they call it a
space yacht—aren't dead, that they're only in suspended animation.
And they've decided in some uneasiness that they'd better take them
back to Earth to be revived."
"How nice! I knew they were sweet little creatures!"
Rhadampsicus hesitated a moment.
"From the male's mind I gather something else. Since the crew of
this space yacht was incapacitated, and they were—ah—not
employed on it, he and your female will bring it safely to port, and, I
gather that they have a claim to great reward. Ah—it is something
they call 'salvage.' He plans to use it to secure other rewards he calls
'patents' and they expect to live happily ever after."
"And," cried Nodalictha gleefully, "from the female's mind I know
that she is very proud of him, because she doesn't know that you
designed all the instruments he made, darling. She's speaking to him
now, telling him she loves him very dearly."
Then Nodalictha blushed a little, because in a faraway space yacht
Cathy had kissed Lon Simpson. The process seemed highly
indecorous to Nodalictha, so recently a bride.
"Yes," said Rhadampsicus, drily. "He is returning the compliment. It
is quaint to think of such small creatures—Ha! Nodalictha, you
should be pleased again. He is telling her that they will be married
when they reach Earth, and that she shall have a white dress and a
veil and a train. But I am afraid we cannot follow to witness the
ceremony."
Their tentacles linked and their positron blasts mingling, the two of
them soared up from the surface of the ninth planet of Cetis
Gamma. They swept away, headed for their home at the extreme
outer tip of the most far-flung arm of the spiral outposts of the
Galaxy.
"But still," said Nodalictha, as they swept through emptiness at a
speed unimaginable to humans, "they're wonderfully cute."
"Yes, darling," Rhadampsicus agreed, unwilling to start an argument
so soon after the wedding. "But not as cute as you."

On the space yacht, Lon Simpson tried to use his genius to invent a
way to get his handcuffs and leg-irons off. He failed completely.
Cathy had to get the keys out of the skipper's pocket and unlock
them for him.
*** END OF THE PROJECT GUTENBERG EBOOK THE
SENTIMENTALISTS ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.

You might also like