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

Programming In C EST 102 1st Edition Jayaraj V S instant download

The document is a comprehensive guide to 'Programming in C' as per the KTU 2019 syllabus for Semester 2, edited by Jayaraj V S and Sivapriya P M. It covers various topics including computer architecture, software types, structured programming, C language basics, control flow statements, functions, pointers, and file operations. Additionally, it provides links to related eBooks and resources for further learning.

Uploaded by

inuwaalgol
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)
18 views

Programming In C EST 102 1st Edition Jayaraj V S instant download

The document is a comprehensive guide to 'Programming in C' as per the KTU 2019 syllabus for Semester 2, edited by Jayaraj V S and Sivapriya P M. It covers various topics including computer architecture, software types, structured programming, C language basics, control flow statements, functions, pointers, and file operations. Additionally, it provides links to related eBooks and resources for further learning.

Uploaded by

inuwaalgol
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/ 81

Programming In C EST 102 1st Edition Jayaraj V S

install download

https://ebookmeta.com/product/programming-in-c-est-102-1st-
edition-jayaraj-v-s/

Download more ebook from https://ebookmeta.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!

ANALOG INTEGRATED CIRCUITS AND SIMULATION LAB MANUAL


ECL331 1st Edition V S Jayaraj

https://ebookmeta.com/product/analog-integrated-circuits-and-
simulation-lab-manual-ecl331-1st-edition-v-s-jayaraj/

Computer graphics programming in OpenGL with C 2nd


Edition V Scott Gordon

https://ebookmeta.com/product/computer-graphics-programming-in-
opengl-with-c-2nd-edition-v-scott-gordon/

Programming in C Third Edition Kamthane

https://ebookmeta.com/product/programming-in-c-third-edition-
kamthane/

Ruth Bridges and Boundaries Das Alte Testament im


Dialog An Outline of an Old Testament Dialogue Jonathan
Grossman

https://ebookmeta.com/product/ruth-bridges-and-boundaries-das-
alte-testament-im-dialog-an-outline-of-an-old-testament-dialogue-
jonathan-grossman/
My First Nursery Rhymes Kim Mitzo Thompson Karen Mitzo
Hilderbrand

https://ebookmeta.com/product/my-first-nursery-rhymes-kim-mitzo-
thompson-karen-mitzo-hilderbrand/

SCHWESERNOTES™ 2023 LEVEL II CFA® BOOK 5: PORTFOLIO


MANAGEMENT AND ETHICAL AND PROFESSIONAL STANDARDS 1
Edition Kaplan Schweser

https://ebookmeta.com/product/schwesernotes-2023-level-ii-cfa-
book-5-portfolio-management-and-ethical-and-professional-
standards-1st-edition-kaplan-schweser/

Servant For An Alien Leader Intergalactic Exchange


Program 8 1st Edition Roxie Ray [Ray

https://ebookmeta.com/product/servant-for-an-alien-leader-
intergalactic-exchange-program-8-1st-edition-roxie-ray-ray/

Advertising and Consumer Society 2nd Edition Nicholas


Holm

https://ebookmeta.com/product/advertising-and-consumer-
society-2nd-edition-nicholas-holm/

Nothing Gold Can Stay Liam Campbell 03 Dana Stabenow

https://ebookmeta.com/product/nothing-gold-can-stay-liam-
campbell-03-dana-stabenow/
Hyperspectral Imaging (Volume 32) (Data Handling in
Science and Technology, Volume 32) 1st Edition Jose
Manuel Amigo

https://ebookmeta.com/product/hyperspectral-imaging-
volume-32-data-handling-in-science-and-technology-volume-32-1st-
edition-jose-manuel-amigo/
Programming In C
EST-102

As per KTU 2019 syllabus for Semester 2

Jayaraj V S
Sivapriya P M
Programming In C
EST-102

As per KTU 2019 syllabus for Semester 2

Edited By

Jayaraj V S
Sivapriya P M
I would like to dedicate this book
to
My beloved father late Shri R Vamadevan
and
My beloved mother late Smt Sheela Vamadevan
Table of Contents
Preface
About The Editors

Module I
1.1 Basics of Computer Architecture 1

1.1.1 Components of a computer 1


1.1.2 Computing Concepts of a Computer 2

1.1.3 Computer Architecture 3


1.2 System Software and Application Software 6
1.2.1 High-level and Low-level languages 8
1.2.2 Compilers and Interpreters 10
1.3 Introduction to structured approach to programming 12

1.3.1 Algorithm and Flowchart 13

1.3.2 Classification of Algorithms 18


1.3.3 Flowchart definition 19
1.4 Pseudo code 23

1.4.1 Common keywords used in pseudo code 24

1.4.2 Linear search in C 27

1.4.3 Bubble sort in C 30

Module II
Brief History of C Programming Language 35
2.1 Basic structure of C program 38

2.1.1 Character set in C 40


2.1.2 Tokens in C 44
2.1.2.1 Keywords 44
2.1.2.2 Identifiers 45
2.1.2.3 Strings in C 46
2.1.2.4 Operators in C 46
2.1.3 C Variable, Data types, Constants 47
2.1.3.1 Variable 47
2.1.3.2 Data types 48
2.1.3.2.1 Integer data type 49
2.1.3.2.2 Floating point data type 49
2.1.3.2.3 Character data type 49
2.1.3.2.4 Void data type 50
2.1.3.3 Constants 50
2.1.3.3.1 Integer constants 50
2.1.3.3.2 Character constants 50
2.1.3.3.3 String constants 51
2.1.3.3.4 Real Constants 51
2.1.4 Console Input/output Operations: printf() and scanf() 51

2.2 Operators and Expressions 57


2.2.1 Arithmetic Operators 57
2.2.2 Relational Operators 58

2.2.3 Logical Operators 60


2.2.4 Bitwise Operators 61
2.2.5 Assignment Operator 62
2.2.6 Misc Operator 63
2.2.6.1 Sizeof Operator in C 64
2.2.6.2 Conditional Expression (Ternary operator) 65
2.2.7 Precedence of operators 66
2.3 Control Flow Statements 68
2.3.1 Branching 69
2.3.1.1 If Statement 69
2.3.1.2 If-else statement 72
2.3.1.3 If else-if ladder 73
2.3.1.4 Nested if 75
2.3.2 C Switch Statement 77
2.3.3 Unconditional Branching using goto statement 80

2.3.4 C Loops 82
2.3.4.1 do-while loop in C 83
2.3.4.2 While loop in C 84
2.3.4.2.1 Infinitive while loop in C 86
2.3.4.3 For loop in C 87
2.3.4.3.1 Loop expressions For loop 88
2.3.4.3.2 Infinitive for loop in C 92
2.3.5 Break and Continue statements 92
2.3.5.1 C break 92
2.3.5.2 C Continue 93

2.3.6 Simple C programs 95

Module III

3.1 Arrays Declaration and Initialization 102


3.1.1 Declaration of Array in C 103
3.1.2 Initialization of C Array 103

3.1.3 C Array: Declaration with Initialization 104


3.1.4 Two-Dimensional Array in C 106
3.1.4.1 Declaration of two-dimensional Array in C 106
3.1.4.2 Initialization of 2D Array in C 107
3.2 String processing 109
3.2.1 Difference between char array and string literal 109
3.2.2 How to initialize strings? 109
3.2.3 Traversing String 110

3.2.4 Accepting string as the input 112


3.3 String handling functions 113

3.3.1 C String Length: strlen() function 113


3.3.2 C String Copy: strcpy () function 114
3.3.3 C String Concatenation: strcat () function 115
3.3.4 C String Comparison: strcmp () function 116
3.2.5 C gets() and puts() functions 117
3.2.5.1 C gets() function 117
3.2.5.2 C puts() function 119
3.4 Linear search and Bubble sort program, simple programs covering arrays 119
and strings
3.4.1 Linear Search Program to search an element in an array 119
3.4.2 Bubble sort Program to sort elements in an array 121
3.4.3 Simple programs covering arrays and strings 123

Module IV
4.1 Working with functions 145
4.1.1 Functions in C 145
4.1.2 Types of function 146
4.1.2.1 Standard library functions 146
4.1.2.2 User-defined function 147
4.1.3 Working of a function in C 147
4.1.4 Declaration / Defining a function 148
4.1.5 Calling a function 149
4.1.6 Example of a User-defined function 149
4.1.7 Different aspects of function calling in C 150
4.1.7.1 Function without arguments and without return value 150
4.1.7.2 Function without arguments and with return value 151
4.1.7.3 Function with arguments and without return value 152
4.1.7.4 Function with arguments and with return value 153
4.1.8 Actual and Formal arguments in C 154
4.1.8.1 Actual arguments 154
4.1.8.2 Formal Arguments 154
4.2 Working with functions continued 156
4.2.1 Call by value in C 156
4.2.1.1 Call by Value Example: Swapping the values of the 156
two variables
4.2.2 Recursion in C 157
4.2.2.1 Recursion function 157
4.2.2.2 How recursion works? 158
4.2.3 Arrays as Function Parameters / Passing arrays as parameter to 161
function
4.2.3.1 Passing a single array element to a function 161
4.2.3.2 Passing a complete One-dimensional array to a 162
function
4.2.3.3 Passing a Multi-dimensional array to a function 163
4.2.3.4 More Examples 164
4.3 Working with functions continued 166
4.3.1 C Structure 166
4.3.1.1 Defining a structure in C 166
4.3.1.2 Declaring Structure Variables 167
4.3.1.3 Accessing Structure Members 167
4.3.1.4 Structure Initialization 169
4.3.1.5 Array of Structure 170
4.3.1.6 Nested Structures 173
4.3.1.7 typedef in C 176
4.3.1.7.1 Structure definition using typedef 177
4.3.2 C Union 179
4.3.2.1 Defining union 179
4.3.2.2 Create union variables 180
4.3.2.3 Difference between structures and unions 182
4.3.2.4 Accessing Union Members 184
4.3.2.5 Comparing Structures and unions 185
4.3.3 Storage Classes in C 186
4.3.3.1 The auto Storage Class 187
4.3.3.2 The extern Storage Class 188
4.3.3.3 The static Storage Class 189
4.3.3.4 The register Storage Class 190
4.3.4 Scope and life time of variables 190
4.3.5 Simple programs using functions 191

Module V
5.1 Basics of Pointer 205
5.1.1 What is Pointer in C Programming? 205
5.1.2 Declaring a pointer 205
5.1.2.1 Pointer to integer, double, character, float 205
5.1.2.2 Pointer to array 206
5.1.2.3 Pointer to a function 206
5.1.3 Advantages of pointer 206
5.1.4 Usage of pointer 206
5.1.5 Address Of (&) Operator 206
5.1.6 NULL Pointer 207
5.1.7 Working of Pointers 207
5.1.7.1 Pointer Example: Assigning addresses to Pointers 207
5.1.7.2 Pointer Example: Get Value of Thing Pointed by 208
Pointers
5.1.7.3 Pointer Example: Changing Value Pointed by 208
Pointers
5.1.7.4 Pointer Example: Using pointers to print the address 209
and value
5.1.7.5 Pointer Example: Working of Pointers 210
5.1.8 Common mistakes when working with pointers 210
5.1.9 Arrays and Pointers 211
5.1.9.1 Relationship Between Arrays and Pointers 211
5.1.9.2 Pointer to an Array in C 214
5.1.9.3 Arrays of Pointers in C 215
5.1.9.4 Sample programs demonstrating Working of 215
Pointers
5.1.10 Call by reference in C 220
5.1.11 Dynamic memory allocation in C 221
5.1.11.1 malloc() 222
5.1.11.2 calloc() 222
5.1.11.3 realloc() 222
5.1.11.4 free() 222
5.2 File Operations 226
5.2.1 Introduction to File Handling 226
5.2.2 C File Operations 227
5.2.2.1 Opening a file 227
5.2.2.2 Reading a File 228
5.2.2.3 Writing to a file 230
5.2.2.4 Closing a file: fclose() 232
5.2.2.5 Appending a file 232
5.2.3 Reading and writing to a binary file 233
5.2.3.1 Writing to a binary file 233
5.2.3.2 Reading from a binary file 234
5.2.3.3 Appending to a binary file 235
5.3 Sequential access and random access to files 237
5.3.1 What is Sequential Access? 237
5.3.2 What is Random Access? 237
5.3.3 Advantages of Sequential access and random access to files 237
5.3.4 Random access/Direct access files 237
5.3.5 C fseek() function 237
5.3.6 C rewind() function 240
5.3.7 C ftell() function 240
5.3.8 feof() function 241
5.3.9 Simple programs covering pointers and files 242

251
C PROGRAMMING LAB
LIST OF LAB EXPERIMENTS 252
1 Familiarization of Hardware Components of a Computer 254
2 Familiarization of Linux environment – How to do Programming in C with 256
Linux
3 Familiarization of console I/O and operators in C 261
i) Display “Hello World”
ii) Read two numbers, add them and display their sum
iii) Read the radius of a circle, calculate its area and display it
iv) Evaluate the arithmetic expression ((a -b / c * d + e) * (f +g)) and
display its solution. Read the values of the variables from the user
through console.
4 Read 3 integer values and find the largest among them. 263
5 Read a Natural Number and check whether the number is prime or not. 263
6 Read a Natural Number and check whether the number is Armstrong or not. 264
7 Read n integers, store them in an array and find their sum and average. 265
8 Read n integers, store them in an array and search for an element in the 267
array using an algorithm for Linear Search.
9 Read n integers, store them in an array and sort the elements in the array using 268
Bubble Sort algorithm.
10 Read a string (word), store it in an array and check whether it is a palindrome 270
word or not.
11 Read two strings (each one ending with a $ symbol), store them in arrays and 271
concatenate them without using library functions.
12 Read a string (ending with a $ symbol), store it in an array and count the 272
number of vowels, consonants and spaces in it.
13 Read two input each representing the distances between two points in the 273
Euclidean space, store these in structure variables and add the two distance
values.
14 Using structure, read and print data of n employees (Name, Employee Id and 274
Salary).
15 Declare a union containing 5 string variables (Name, House Name, City 276
Name, State and Pin code) each with a length of C_SIZE (user defined
constant). Then, read and display the address of a person using a variable of
the union.
16 Find the factorial of a given Natural Number n using recursive and non- 277
recursive functions.
17 Read a string (word), store it in an array and obtain its reverse by using a user 279
defined function.
18 Write a menu driven program for performing matrix addition, multiplication 280
and finding the transpose.
Use functions to
(i) Read a matrix.
(ii) Find the sum of two matrices.
(iii) Find the product of two matrices.
(iv) Find the transpose of a matrix
(v) Display a matrix.
19 Do the following using pointers 284
i) add two numbers
ii) swap two numbers using a user defined function
20 Input and print the elements of an array using pointers. 286
21 Compute sum of the elements stored in an array using pointers and user 287
defined function.
22 Create a file and perform the following 288
i) Write data to the file
ii) Read the data in a given file & display the file content on
console
iii) Append new data and display on console
23 Open a text input file and count number of characters, words and lines in it; 289
and store the results in an output file.

Bibliography
Preface
This book is intended for all aspirants who would like to begin exploring their programming
skills with C. C is currently the premier language for software developers as it’s widely
distributed and standardized. Newer languages are available, such as Python, Java, R etc. but
still C is the language of choice for robust and portable programming. This is because System
level programming and Embedded system programming still dependent on C.
This book emphasizes the basic skills one requires to solve real-world programming problems.
It teaches you not only the mechanics of the C language, but helps you to understand the
concepts clearly with usage of different color shades in code presentation and explanation.
In order to bridge the gap between theory and practical, each concept is explained at length in
an easy-to-understand manner supported with numerous worked-out examples and programs.
The Codes presented in this book are compiled and run-on Visual Studio Code. Visual Studio
Code is a lightweight but powerful source code editor which runs on your desktop and is
available for Windows, macOS and Linux. It comes with a rich ecosystem of extensions for
languages (such as C++, C#, Java, Python, PHP, Go). Using Visual Studio Code would help a
beginner to visually understand and rectify the errors while coding.
Anybody can write a code, but real skill lies in the way a code is written and presented. So, to
create a good program, one must do more than just type in a code. It is always expected from
a programmer to blend both writing and programming skills together to form a simple, readable
and easy to understand Code.
Book Organization
As this book is edited as per the KTU syllabus, it is organized into two parts:
i) Module by Module
Module-I: Gives a basic understanding of computer components and its
architecture along with best method of writing algorithms and drawing of flowchart.
It also describes the writing of Pseudo code.
Module-II: Gives a basic understanding of the structure of a C program, Operators
and Expressions and also in detail the programming with Control Flow Statements.
Module-III: Gives a detail understanding of Arrays and Strings along with
programs covering arrays and strings.
Module-IV: Introduces to modular programming, Functions, Recursion, Arrays as
Function Parameters, Structure, Union, Storage Classes, Scope and life time of
variables.
Module-V: Introduces to Basics of Pointers, File Operations in C, Sequential
access and Random access to files.
ii) Lab Programs
A list of 23 programs as per the syllabus is provided to give the students a better
hand on session with topics learned from modules in part one.

As editors of this book, we are very delighted to present the First Edition of Programming in
C, which is free and can be downloaded from jayarajvamadevan (Jayaraj Vamadevan) · GitHub .
We have tried to make this book Student friendly by using simple and lucid language.
We hope both student community and teaching fraternity are benefitted by our book.

Jayaraj V S
Sivapriya P M
About The Editors
Jayaraj V S did his BE in Electronics & Communication Engineering in 2005
from Mohammed Sathak Engineering College, Kilakarai and ME in
Communication Systems in 2007 from Mepco Schlenk Engineering College,
Sivakasi. Currently working as a faculty of Sree Buddha College of Engineering,
Pattoor.

Sivapriya P M did her BTech in Computer Science in 2009 from Government


Engineering College Palakkad, Sreekrishnapuram. Currently working with the
Department of Post Government of India.
MODULE BY MODULE
(Theory part of EST 102, Programming in C)
Module-I

Basics of Computer Hardware and Software


1.1 Basics of Computer Architecture: Processor, Memory, Input& Output devices

1.2 Application Software & System software: Compilers, interpreters, High level and
low-level languages
1.3 Introduction to structured approach to programming, Flow chart
1.4 Algorithms, Pseudo code (bubble sort, linear search - algorithms and pseudo code)

1.1 Basics of Computer Architecture


What is a computer?
“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.
The main task of a computer system is to process the given input of any type in an efficient
manner. Therefore, computer is also known by various other names such as data processing
unit, data processor and data processing system.
1.1.1 Components of a computer
Computer includes various devices that function as an integrated system to perform several
tasks described above.
These devices are:
1) 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. It is the “brain” of the computer.

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

The components of a computer

1.1.2 Computing Concepts of a Computer


We can understand how a computer functions by analysing the fundamental computing
concepts. The most elementary computing concepts include receiving input known as data
from the user, manipulating the input according to the given set of instructions and delivering
the output known as information to the user. Figure below shows the functioning of a
computer based on these concepts.

The Input-Process-Output Cycle of a computer

2
The various functions performed by the computer are briefly described below:
a) Accepting the raw data
The first task to be performed by a computer is to accept the data from the user, with the help
of an input device, such as mouse and keyboard. Mouse is used to enter the data through
point-and-click operation while keyboard is used to enter the character data by typing the
various keys.
b) Processing the data
The data is processed with the help of specific instructions known as programs after taking
the input from the user. The manipulation of data is handled by the CPU of the computer.
CPU is considered as the brain of the computer because it controls the execution of various
instructions. The raw data entered by the user through input devices is processed by the CPU
to generate meaningful information.
c) Storing the data
The data is stored in the main memory of a computer in its processed form. The various
external storage devices—such as hard disk and magnetic disk—can also be used for storing
the processed data so that it can again be fetched later.
d) Delivering the output
The processed data is delivered as useful information to the user with the help of output
devices, such as printer and monitor.
1.1.3 Computer Architecture
Computer architecture is a science or a set of rules stating how computer software and
hardware join and interact to make a computer work. The architecture basically defines the
logical structure of a computer system.
Historically there have been 2 types of Computers:
a) Fixed Program Computers – Their function is very specific, and they couldn’t be
programmed, e.g., Calculators.
b) Stored Program Computers – These can be programmed to carry out many different
tasks, applications are stored on them, hence the name.
The modern computer is based on a stored-program concept introduced by John Von
Neumann and has three basic units.
 The Central Processing Unit (CPU)
 Memory Unit
 The Input / Output Unit

3
Von Neumann Architecture
1) The Central Processing Unit (CPU)
A Central Processing Unit is also called a processor, central processor, or microprocessor. It
carries out all the important functions of a computer. It receives instructions from both the
hardware and active software and produces output accordingly. It stores all important
programs like operating systems and application software.
CPU also helps Input and output devices to communicate with each other. Owing to these
features of CPU, it is often referred to as the brain of the computer.
CPU is installed or inserted into a CPU socket located on the motherboard. Furthermore, it is
provided with a heat sink to absorb and dissipate heat to keep the CPU cool and functioning
smoothly.
It basically has three main units:
a) Arithmetic and Logic Unit (ALU)
b) Control Unit
c) Main Memory Unit (Registers)
a) Arithmetic and Logic Unit (ALU)
It is the arithmetic logic unit, which performs arithmetic and logical functions. Arithmetic
functions include addition, subtraction, multiplication division, and comparisons. Logical
functions mainly include selecting, comparing, and merging the data. A CPU may contain
more than one ALU. Furthermore, ALUs can be used for maintaining timers that help run the
computer.

4
b) Control Unit
It is the circuitry in the control unit, which makes use of electrical signals to instruct the
computer system for executing already stored instructions. It takes instructions from memory
and then decodes and executes these instructions. So, it controls and coordinates the
functioning of all parts of the computer. The Control Unit's main task is to maintain and
regulate the flow of information across the processor. It does not take part in processing and
storing data.
c) Main Memory Unit (Registers)
 Accumulator: Stores the results of calculations made by ALU.
 Program Counter (PC): Keeps track of the memory location of the next
instructions to be dealt with. The PC then passes this next address to
Memory Address Register (MAR).
 Memory Address Register (MAR): It stores the memory locations of
instructions that need to be fetched from memory or stored into memory.
 Memory Data Register (MDR): It stores instructions fetched from memory
or any data that is to be transferred to, and stored in, memory.
 Current Instruction Register (CIR): It stores the most recently fetched
instructions while it is waiting to be coded and executed.
 Instruction Buffer Register (IBR): The instruction that is not to be
executed immediately is placed in the instruction buffer register IBR.
2) Memory Unit
Computer memory is any physical device capable of storing information temporarily, like
RAM (random access memory), or permanently, like ROM (read-only memory).
Memories can be classified into two categories:
 Primary Memory
 Secondary Memory
a) Primary memory is computer memory that is accessed directly by the CPU. There are
two types of primary memory.
 Read Only Memory (ROM)
 Random Access Memory (RAM)
ROM: The content of it cannot be changed and can be used only by CPU. It is needed to
store Basic Input Output System (BIOS), which is responsible for booting. This memory is
permanent in storage (non-volatile) and is very small in size.

5
RAM: It is a volatile memory i.e.; its contents get destroyed as soon as the computers is
switched off. All kinds of processing of CPU are done in this memory.
b) Secondary Memory
Primary memory has limited storage capacity and is volatile. Secondary memory overcomes
this limitation by providing permanent storage of data and in bulk quantity. Secondary
memory is also termed as external memory and refers to the various storage media on which
a computer can store data and programs. The Secondary storage media can be fixed or
removable. Fixed Storage media is an internal storage medium like hard disk that is fixed
inside the computer. Storage medium that are portable and can be taken outside the computer
are termed as removable storage media.
Example: Hard disk, Magnetic Tapes, Pen drive.
3) Input /Output Unit
The input/output unit consists of devices used to transmit information between the external
world and computer memory. The information fed through the input unit is stored in
computer memory for processing and the result stored in memory can be recorded or display
on the output medium.
Example: Mouse, Keyboard, Printer, Monitor, etc.

1.2 System Software and Application Software


Software is a set of programs, which is designed to perform a well-defined function. A
program is a sequence of instructions written to solve a particular problem.
There are two types of software –
 System Software
 Application Software
a) System Software
The system software is a collection of programs designed to operate, control, and extend the
processing capabilities of the computer itself. System software is generally prepared by the
computer manufacturers. These software products comprise of programs written in low-level
languages, which interact with the hardware at a very basic level. System software serves as
the interface between the hardware and the end users.
Examples - Operating System, Compilers, Interpreter, Assemblers, etc.
Some of the most prominent features of system software −
 Close to the system
 Fast in speed

6
 Difficult to design
 Difficult to understand
 Less interactive
 Smaller in size
 Difficult to manipulate
 Generally written in low-level language
b) Application Software
Application software products are designed to satisfy a particular need of a particular
environment. All software applications prepared in the computer lab can come under the
category of Application software.
Application software may consist of a single program, such as Microsoft's notepad for
writing and editing a simple text. It may also consist of a collection of programs, often called
a software package, which work together to accomplish a task, such as MS Office.
Examples − Railways Reservation Software, Microsoft Office Suite Software, Microsoft
Word, Microsoft Excel, Microsoft PowerPoint.
Some of the most prominent features of application software are as follows −
 Close to the user
 Easy to design
 More interactive
 Slow in speed
 Generally written in high-level language
 Easy to understand
 Easy to manipulate and use
 Bigger in size and requires large storage space

S.no System software Application software


System Software maintains the Application software is built for specific
1 system resources and gives the path tasks.
for application software to run.
Low level languages are used to High level languages are used to write the
2 write the system software. application software.

Machine Dependent Machine independent


3

4 It is general-purpose software. It is specific purpose software.

7
Without system software, system Without application software system always
5 can’t run. runs.
System software runs when system While application software runs as per the
6 is turned on and when system is user’s request.
turned off.
Compiler, Operating System, Photoshop, Microsoft Office, VLC
7 Interpreter

1.2.1 High-level and Low-level languages


What is a programming language?
A programming language defines a set of instructions that are compiled together to perform a
specific task by the CPU (Central Processing Unit). The programming language mainly refers
to high-level languages such as C, C++, Pascal, COBOL, etc.
Basically, there are two main categories of computer languages, namely Low-Level
Language and High-Level Language.
1) Low Level Languages
Low level languages are the basic computer instructions or better known as machine codes. A
computer cannot understand any instruction given to it by the user in English or any other
high-level language. These low-level languages are very easily understandable by the
machine.
The main function of low-level languages is to interact with the hardware of the computer.
They help in operating, syncing, and managing all the hardware and system components of
the computer. They handle all the instructions which form the architecture of the hardware
systems.
a) Machine Language
This is one of the most basic low-level languages. The language was first developed to
interact with the first-generation computers. It is written in binary code or machine code,
which means it basically comprises of only two digits – 1 and 0.
b) Assembly Language
This is the second-generation programming language. It is a development on the machine
language, where instead of using only numbers, we use English words, names, and symbols.
It is the most basic computer language necessary for any processor.
2) High Level Language
When we talk about high level languages, these are programming languages. Some prominent
examples are PASCAL, FORTRAN, C++ etc.

8
The important feature about such high-level languages is that they allow the programmer to
write programs for all types of computers and systems. Every instruction in high level
language is converted to machine language for the computer to comprehend.
a) Scripting Languages
Scripting languages or scripts are essentially programming languages. These languages
employ a high-level construct which allows it to interpret and execute one command at a
time.
Scripting languages are easier to learn and execute than compiled languages. Some examples
are AppleScript, JavaScript, Pearl etc.
b) Object-Oriented Languages
These are high level languages that focus on the ‘objects’ rather than the ‘actions. To
accomplish this, the focus will be on data than logic.
The reasoning behind is that the programmers really care about the object they wish to
manipulate rather than the logic needed to manipulate them. Some examples include Java,
C+, C++, Python, Swift etc.
c) Procedural Programming Language
This is a type of programming language that has well-structured steps and complex
procedures within its programming to compose a complete program.
It has a systematic order functions and commands to complete a task or a program. C,
FORTRAN, ALGOL, BASIC, COBOL is some examples.

High level Vs Low level language

Low-level language High-level language

It is a machine-friendly language, It is a user-friendly language as this language is


i.e., the computer understands the written in simple English words, which can be
machine language, which is easily understood by humans.
represented in 0 or 1.

The low-level language takes more It executes at a faster pace.


time to execute.

It requires the assembler to convert It requires the compiler to convert the high-level
the assembly code into machine language instructions into machine code.
code.

9
The machine code cannot run on all The high-level code can run all the platforms, so it
machines, so it is not a portable is a portable language.
language.

It is memory efficient. It is less memory efficient.

Debugging and maintenance are not Debugging and maintenance are easier in a high-
easier in a low-level language. level language.

1.2.2 Compilers and Interpreters


a) Interpreter
In computer terms, the programming interpreter reads the first line of the code, interprets it
into machine code and sends it to the CPU to be processed. It then interprets the next line and
sends that to the CPU, and so on. By interpreting the program line by line, the program can
immediately start running. However, since every line needs to be interpreted before it can
run, the program will often run a bit more slowly than a compiled program. The source code
is interpreted as the program is run; the interpreter (and interpreted language) must be
installed on the same computer that the program is running. The examples of an interpreted
language are JavaScript, Python 2, and Python 3.
b) Compiler
In contrast to an interpreter, the compiler takes the entire source code and translates it into
machine code. This translated code is saved as an executable file on the computer that can be
opened on any computer without requiring the computer to have a compiler. Examples of
compiled languages include BASIC, C, C++, Delphi, and Java.
Compilation process of C programming passes through following stages before being
transformed into an executable form:
 Pre-processor
 Compiler
 Assembler
 Linker
Pre-processor: The source code is the code which is written in a text editor and the source
code file is given an extension ".c". This source code is first passed to the pre-processor, and
then the pre-processor expands this code. After expanding the code, the expanded code is
passed to the compiler.

10
Compiler: The code which is expanded by the pre-processor is passed to the compiler. The
compiler converts this code into assembly code. Or we can say that the C compiler converts
the pre-processed code into assembly code.
Assembler: The assembly code is converted into object code by using an assembler. The
name of the object file generated by the assembler is the same as the source file. The
extension of the object file in DOS is '.obj. If the name of the source file is 'hello.c', then the
name of the object file would be 'hello.obj'.
Linker: Mainly, all the programs written in C use library functions. These library functions
are pre-compiled, and the object code of these library files is stored with '.lib' (or ‘. a')
extension. The main working of the linker is to combine the object code of library files with
the object code of our program. The output of the linker is the executable file. The name of
the executable file is the same as the source file but differs only in their extensions. In DOS,
the extension of the executable file is '.exe'. For example, if we are using printf () function in
a program, then the linker adds its associated code in an output file.

Compiler Vs Interpreter
Basis of
Compiler Interpreter
comparison
A compiler converts high-level Interpreter converts source code into
language program code into the intermediate form and then
Function
machine language and then converts that intermediate code into
executes it. machine language

11
Complier scans the entire Interpreter scans and translates the
Scanning program first before translating program line by line to equivalent
into machine code. machine code.
Compiler takes entire program Interpreter takes single instruction as
Working
as input. input.
Code Intermediate object code is In case of interpreter, no intermediate
Generation generated in case of compiler. object code is generated.
Compiler takes less execution
Execution Interpreter takes more execution time
time when compared to
Time when compared to compiler.
interpreter.

Memory Compiler requires more memory Interpreter needs less memory when
Requirement than interpreter. compared to compiler.
If you happen to make any
modification in program you If you make any modification and if
have to recompile entire that line has not been scanned, then
Modification
program i.e., scan the whole no need to recompile entire program.
program every time after
modification.

Compiler is faster when Interpreter is slower when compared


Speed
compared to interpreter. to compiler.

There is usually no need to


Every time program is scanned and
At Execution compile program every time (if
translated at execution time.
not modified) at execution time.
Compiler gives you the list of all Interpreter stops the translation at the
Error errors after compilation of whole error generation and will continue
Detection
program. when error get solved.
Compiler is slow for debugging
because errors are displayed Interpreter is good for fast
Debugging
after entire program has been debugging.
checked.

Examples C, COBOL, C#, C++, etc Python, VB, Java Script etc.

1.3 Introduction to structured approach to programming


Structured Programming Approach, as the word suggests, can be defined as a
programming approach in which the program is made as a single structure. It means that the
code will execute the instruction by instruction one after the other. It doesn’t support the
possibility of jumping from one instruction to some other with the help of any statement like

12
GOTO, etc. Therefore, the instructions in this approach will be executed in a serial and
structured manner.
The structured program mainly consists of three types of elements:
 Selection Statements
 Sequence Statements
 Iteration Statements
The structured program consists of well-structured and separated modules. But the entry and
exit in a structured program is a single-time event. It means that the program uses single-
entry and single-exit elements. Therefore, a structured program is well maintained, neat and
clean program. This is the reason why the Structured Programming Approach is well
accepted in the programming world.
Advantages of Structured Programming Approach:
 Easier to read and understand
 User Friendly
 Easier to Maintain
 Mainly problem based instead of being machine based
 Development is easier as it requires less effort and time
 Easier to Debug
 Machine-Independent, mostly.
Disadvantages of Structured Programming Approach:
1. Since it is Machine-Independent, so it takes time to convert into machine code.
2. The converted machine code is not the same as for assembly language.
3. The program depends upon changeable factors like datatypes. Therefore, it needs to be
updated with the need on the go.
4. Usually, the development in this approach takes longer time as it is language dependent.
Whereas in the case of assembly language, the development takes lesser time as it is
fixed for the machine.

1.3.1 Algorithm and Flowchart


Algorithm definition-In programming, algorithm is a set of well-defined instructions in
sequence to solve the problem.
Qualities of a good algorithm
 Input and output should be defined precisely.
 Each step-in algorithm should be clear and understandable.

13
 Algorithm should be most effective among many ways to solve a problem.
 An algorithm shouldn’t have computer code. Instead, the algorithm should be written
in such a way that, it can be used in similar programming languages.
Examples of Algorithms in Programming
1) Write an algorithm to add two numbers entered by user.

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum←num1+num2
Step 5: Display sum
Step 6: Stop
2) Write an algorithm to find the largest among three different numbers entered by
user.

Step 1: Start
Start 2: Input a, b, c
Start 3: If a > b goto step 4, otherwise goto step 5
Start 4: If a > c goto step 6, otherwise goto step 8
Start 5: if b > c goto step 7, otherwise goto step 8
Start 6: Output "a is the largest", goto step 9
Start 7: Output "b is the largest", goto step 9
Start 8: Output " c is the largest", goto step 9
Start 9: Stop
3) Finding Area of the square
Step 1: Start
Step 2: Declare the variables length and area.
Step 3: Read the value of length.
Step 4: Multiply length and length and assign the result to area.
area← length * length
Step 5: Display area
Step 6: Stop

14
4) Finding Area of a square with 3 different sides
Step 1: Start
Step 2: Declare the variables a, b, c, s and Area.
Step 3: Read the value of a, b and c.
Step 4: Compute semi-perimeter and assign the value to s
s← (a + b + c)/2
Step 4: Compute the area and assign the result to Area
Area← sqrt(s(s-a) (s-b) (s-c))
Step 5: Display Area
Step 6: Stop
5) Calculating the average for 3 numbers
Step 1: Start
Step 2: Declare variables num1, num2, num3 and Average.
Step 3: Read values num1, num2, and num3.
Step 4: Add num1, num2 and num3 and divide by 3 then assign the result to Average.
Average←(num1+num2+num3) /2
Step 5: Display Average.
Step 6: Stop
6) Greatest of two numbers
Step 1: Start
Step 2: Declare variables A and B
Step 3: Read values of A and B
Step 4: If A ≥ B
Display A is greater than B.
Else
Display B is greater than A.
Step 5: Stop
7) Find Root of the quadratic equation ax2 + bx + c = 0
Step 1: Start
Step 2: Declare variables a, b, c, D, r1, r2, rp and ip
Step 3: Read values of a, b and c.
Step 4: Calculate discriminant and assign the value to D
D ← b2-4ac
Step 4: If D ≥ 0

15
Calculate r1and r2
r1 ← (-b+√D)/2a
r2 ← (-b-√D)/2a
Display r1 and r2 as roots.
Else
Calculate real part and imaginary part
rp ← -b/2a
ip ← √(-D)/2a
Display rp + j(ip) and rp - j(ip) as roots
Step 5: Stop
8) Interchange the value of two numbers
Step 1: Start
Step 2: Declare variables a, b and c
Step 3: Read the value of a and b
Step 3: Perform Swapping of value as
c =a
a=b
b=c
Step 4: Display the value of a and b
Step 5: Stop
9) Find the factorial of a number
Step 1: Start
Step 2: Declare variables F, N and i
Step 3: Initialize the value of F=1 and i=1
Step 4: Read the value of N
Step 5: Multiply F with i and assign the vale to F
F=F*i
Step 6: Increment i by 1
Step 7: Repeat step 5 & 6 until i = N
Step 8: Display the value of F
Step 9: Stop
10) Find the Sum of Natural Numbers till N
Step 1: Start
Step 2: Declare variables count, N and sum

16
Step 3: Read the value of N
Step 4: Initialize count = 1, sum = 0
Step 5: count = count + 1
Step 6: sum = sum + count
Step 7: Repeat step 5 & 6 until count <= N
Step 8: Display the value of sum
Step 9: Stop
11) Find the Sum of all Even Natural Numbers till N
Step 1: Start
Step 2: Declare variables count, N and sum
Step 3: Read the value of N
Step 4: Initialize count = 0, sum = 0
Step 5: count = count + 2
Step 6: sum = sum + count
Step 7: Repeat step 5 & 6 until count <= N
Step 8: Display the value of sum
Step 9: Stop
12) Find the Fibonacci series till the term less than 1000
Step 1: Start
Step 2: Declare variables first_term, second_term and temp.
Step 3: Initialize variables first_term=0, second_term = 1
Step 4: Display first_term and second_term
Step 5: temp = second_term
Step 6: second_term = second_term + first_term
Step 7: first_term = temp
Step 8: Display second_term
Step 9: Repeat the steps 5 to 8 until second_term ≤ 1000
Step 10: Stop

Advantages of algorithm
 It is a stepwise representation of a solution to a given problem, which makes it easy to
understand.
 An algorithm uses a definite procedure.

17
 It is not dependent on any programming language, so it is easy to understand for
anyone even without programming knowledge.
 Every step in an algorithm has its own logical sequence so it is easy to debug.
 By using algorithm, the problem is broken down into smaller pieces or steps hence; it
is easier for programmer to convert it into an actual program.
Disadvantages of algorithm.
 Writing algorithm takes a long time.
 An Algorithm is not a computer program; it is rather a concept of how a program
should be.

1.3.2 Classification of Algorithms


The classification of the algorithm is based on repetitive steps and on control transfer from
one statement to another.
On the basis of repetitive steps, an algorithm can further be classified into two types.
a) Direct Algorithm: - In this type of algorithm, the number of iterations is known in
advance. For example, for displaying numerical numbers from 1 to 10, the loop variable
should be initialized from 1 to 10. The statement would be as follows:
for (j=1; j<=10; j++)
In the above statement, it is predicted that the loop will iterate 10 times.

Classification of Algorithms

18
b) Indirect Algorithm: - In this type of algorithm repetitively steps are executed. Exactly
how many repetitions are to be made is unknown.
For example, the repetitive steps are as follow:
i) To find the first Armstrong numbers from 1 to n, where n is the fifth Armstrong number.
ii) To find the first three palindrome numbers.
Based on the control transfer, the algorithms are categorized in the following three
types.
a) Deterministic: - Deterministic algorithm is based on either to follow a ‘yes’ path or ‘no’
path based on the condition. In this type of algorithm when control comes across a decision
logic, two paths ‘yes’ or ’no’ are shown. Program control follows one of the routes depending
upon the condition.
Example:
Testing whether a number is even or odd. Testing whether a number is positive or negative.
b) Non-deterministic: - In this type of algorithm to reach the solution, we have one of the
multiple paths.
Example:
To find a day of the week.
c) Random algorithm: - After executing a few steps, the control of the program transfer to
another step randomly, which is known as a random algorithm.
Example:
A random search
1.3.3 Flowchart definition-is a diagrammatic representation of sequence of logical steps
of a program. Flowcharts use simple geometric shapes to depict processes and arrows to
show relationships and process/data flow.
Flowchart Symbols
Here is a chart for some of the common symbols used in drawing flowcharts.

Symbol Symbol Name Purpose

Used at the beginning and end of the


Start/Stop algorithm to show start and end of the
program.

Process Indicates processes like mathematical


operations.

19
Input/ Output Used for denoting program inputs and
outputs.

Stands for decision statements in a


Decision program, where answer is usually Yes
or No.

Arrow Shows relationships between different


shapes.

On-page Connects two or more parts of a


flowchart, which are on the same
Connector
page.

Guidelines for Developing Flowcharts


These are some points to keep in mind while developing a flowchart −
 Flowchart can have only one start and one stop symbol
 On-page connectors are referenced using numbers
 Off-page connectors are referenced using alphabets
 General flow of processes is top to bottom or left to right
 Arrows should not cross each other
Advantages of flowchart:
1. The Flowchart is an excellent way of communicating the logic of a program.
2. It is easy and efficient to analyse problem using flowchart.
3. During program development cycle, the flowchart plays the role of a guide or a
blueprint. Which makes program development process easier?
4. After successful development of a program, it needs continuous timely maintenance
during its operation. The flowchart makes program or system maintenance easier.
5. It helps the programmer to write the program code.

20
Examples of flowcharts in programming
1. Add two numbers entered by the user.

2. Find the largest among three different numbers entered by user.

21
3. Find the factorial of a number entered by user.

4. Find the sum of N natural numbers entered by user.

22
5. Find the Fibonacci series till the term N.

1.4 Pseudo code

Pseudo code in C is a simple way to write programming code in English. Pseudo-code is


informal writing style for program algorithm independent from programming languages to
show the basic concept behind the code.
Pseudocode is not an actual programming language. So, it cannot be compiled and not be
converted into an executable program. It uses short or simple English language syntax to
write code for programs before it is converted into a specific programming language.

Guidelines for writing pseudo code:


 Write one statement per line
 Capitalize initial keyword
 Indent to hierarchy
 End multiline structure
 Keep statements language independent

23
1.4.1 Common keywords used in pseudo code
The following gives common keywords used in pseudo codes.
a) //: This keyword used to represent a comment.
b) BEGIN, END: Begin is the first statement and end are the last statement.
c) INPUT, GET, READ: The keyword is used to inputting data.
d) COMPUTE, CALCULATE: used for calculation of the result of the given
expression.
e) ADD, SUBTRACT, INITIALIZE used for addition, subtraction and initialization.
f) OUTPUT, PRINT, DISPLAY: It is used to display the output of the program.
g) IF, ELSE, ENDIF: used to make decision.
h) WHILE ENDWHILE: used for iterative statements.
i) FOR, ENDFOR: Another iterative incremented/decremented tested automatically.
Syntax for if else:
IF (condition)THEN
Statement
...
ELSE
Statement
...
ENDIF

Example: Greatest of two numbers


BEGIN
READ a,b
IF (a>b) THEN
DISPLAY a is greater
ELSE
DISPLAY b is greater
END IF
END

Syntax for for:


FOR ( start-value to end-value) DO
Statement

24
...
ENDFOR
Example: Print n natural numbers
BEGIN
GET n
INITIALIZE i=1
FOR (i<=n) DO
PRINT i
i=i+1
ENDFOR
END

Syntax for While:


WHILE (condition) DO
Statement
...
ENDWHILE

Example: Print n natural numbers


BEGIN
GET n
INITIALIZE i=1
WHILE (i<=n) DO
PRINT i
i=i+1
ENDWHILE
END

Advantages:
 Pseudo is independent of any language; it can be used by most programmers.
 It is easy to translate pseudo code into a programming language.
 It can be easily modified as compared to flowchart.
 Converting a pseudo code to programming language is very easy as compared with
converting a flowchart to programming language.

25
Disadvantages:
 It does not provide visual representation of the program’s logic.
 There are no accepted standards for writing pseudo codes.
 It cannot be compiled nor executed.
 For a beginner, it is more difficult to follow the logic or write pseudo code
as compared to flowchart.
Examples of pseudocode
Example1:
Write a pseudocode to find the largest among three different numbers entered by user.
BEGIN
READ the value of a, b, c.
IF (a>b && a>c) THEN
DISPLAY a is largest
ELSEIF (b>a && b>c) THEN
DISPLAY b is greater
ELSE
DISPLAY c is greater
END IF
END
Example 2:
Write a pseudocode to find the sum of n natural numbers.
BEGIN
INITIALIZE i=1, sum=0.
READ the value of n
FOR (i<=n) DO
CALCULATE sum=sum+i.
INCREMENT i=i+1
ENDFOR
DISPLAY the value of sum.
END
Example 3:
Write a pseudocode to find roots of a quadratic equation.
BEGIN
READ values of a, b and c.

26
CALCULATE D=b*b – 4*a*c
IF (D ≥ 0) THEN
CALCULATE r1and r2
r1 = (-b+√D)/2a
r2 = (-b-√D)/2a
DISPLAY r1 and r2
ELSE
CALCULATE real part and imaginary part
rp = -b/2a
ip = √(-D)/2a
DISPLAY rp + j(ip) and rp - j(ip) as roots
ENDIF
END
Example 4:
Write a pseudocode to find factorial for a given number.
BEGIN
INITIALIZE F=1, i=1.
READ the value of N
FOR (i=N) DO
CALCULATE F=F*i
INCREMENT i=i+1
ENDFOR
DISPLAY the value of F.
END

1.4.2 Linear search in C


Linear search in C to find whether a number is present in an array. If it's present, then at what
location it occurs. It is also known as a sequential search. It is straightforward and works as
follows: we compare each element with the element to search until we find it or the list ends.
Linear search is implemented using following steps...
• Step 1 - Read the search element from the user.
• Step 2 - Compare the search element with the first element in the list.
• Step 3 - If both are matched, then display "Given element is found!!!" and terminate
the function

27
• Step 4 - If both are not matched, then compare search element with the next element
in the list.
• Step 5 - Repeat steps 3 and 4 until search element is compared with last element in
the list.
• Step 6 - If last element in the list also doesn't match, then display "Element is not
found!!!" and terminate the function.
Linear search algorithm
Linear Search (Array A, Value x)
Step 1: Start
Step 2: Declare an array A of size n
Step 3: Declare variables flag, i, x
Step 4: Initialize flag=0and i=0
Step 5: input the number to be searched x
Step 6: If A[i] equal to x
set flag=1
break out of loop
Else
set flag=0
Step 7: Increment i=i+1
Step 8: Repeat the step 6 to 7 till i<n
Step 9: If flag equal to 0
Display The number is not found in the array
Step 10: Else
Display The number is found in the array
Step 11: Stop

Linear search pseudocode


BEGIN
INITIALIZE array A of size n, i=1, flag=0.
READ the value of x.
FOR (i<n) DO
IF (A[i] = x) THEN
SET flag= 1
BREAK

28
ELSE
SET flag= 0
END IF
INCREMENT i=i+1
END FOR
IF (flag= = 0) THEN
DISPLAY The number is not found in the array
ELSE
DISPLAY The number is found in the array
END IF
END

Linear search Flowchart

29
1.4.3 Bubble sort in C
It is a simple sorting algorithm that works by repeatedly stepping through the list to be
sorted, comparing each pair of adjacent items and swapping them if they are in the wrong
order. The pass through the list is repeated until no swaps are needed, which indicates that the
list is sorted.
Working of Bubble Sort
Suppose we are trying to sort the elements in ascending order.
1. First Iteration (Compare and Swap)
1. Starting from the first index, compare the first and the second elements.
2. If the first element is greater than the second element, they are swapped.
3. Now, compare the second and the third elements. Swap them if they are not in order.
4. The above process goes on until the last element.

2. Remaining Iteration
The same process goes on for the remaining iterations.
After each iteration, the largest element among the unsorted elements is placed at the end.

30
In each iteration, the comparison takes place up to the last unsorted element.

The array is sorted when all the unsorted elements are placed at their correct positions.

Bubble sort Algorithm


Bubble Sort (Array A, Value n)
Step 1: Start
Step 2: Declare an array A of size n
Step 3: Declare variables temp, i, j
Step 4: Initialize i=0and j=0
Step 5: Input the value of array
Step 6: if(A[j] > A[j+1])
temp=A[j]
A[j]=A[j+1]
A[j+1] =temp

31
Exploring the Variety of Random
Documents with Different Content
Outrage upon the Raritan Indians.
Indian Revenge.

CHAPTER V.—WAR AND ITS DEVASTATIONS.


Approaching Hostilities.
Noble Remonstrance.
Massacre of the Natives.
The War Storm.
Noble Conduct of De Vrees.
The Humiliation of Kieft.
Wide Spread Desolation.
The Reign of Terror.
State of Affairs at Fort Nassau.
The Massacre at Stamford.
Memorial of the Select Men.
Kieft Superseded by Peter Stuyvesant.

CHAPTER VI.—GOVERNOR STUYVESANT.


New Netherland in 1646.
Early Years of Peter Stuyvesant.
Decay of New Amsterdam.
The Germs of a Representative Government.
Energetic Administration.
Death of Governor Winthrop.
Claims for Long Island.
Arrogance of the Governor.
Remonstrance of the Nine Men.
The Pastoral Office.
Boundary Lines.
Increasing Discontent.
Division of Parties.
Dictatorial Measures.
CHAPTER VII.—WAR BETWEEN ENGLAND AND HOLLAND.
Action of the Patroons.
Settlements on the Hudson.
Alarm of the Home Government.
Recall of Stuyvesant.
His Escape from Humiliation.
Difficulties between England and Holland.
The Breaking Out of War.
Directions to Stuyvesant.
The Relations of the Colonies.
Charges Against the Dutch Governor.
Their Refutation.
Efforts of Stuyvesant for Peace.
Noble Conduct of the Massachusetts Government.
The Advocates for War.

CHAPTER VIII.—ANOTHER INDIAN WAR.


Conflict Between the Governor and the Citizens.
Energy of the Governor.
His Measures of Defence.
Action of the English Colony.
Claims of the Government of Sweden.
Fort Casimir Captured by the Swedes.
Retaliation.
Measures for the Recapture of Fort Casimir.
Shooting a Squaw.
Its Consequences.
The Ransom of Prisoners.
Complaints of the Swedish Governor.
Expedition from Sweden.
Its Fate.
CHAPTER IX.—AN ENERGETIC ADMINISTRATION.
New Amsterdam in 1656.
Religious Intolerance.
Persecution of the Waldenses.
The New Colony on South River.
Wreck of the Prince Maurice.
The Friendly Indians.
Energetic Action of the Governor.
Persecution of the Quakers.
Remonstrance from Flushing.
The Desolation of Staten Island.
Purchase of Bergen.
Affairs at Esopus.
The Indian Council.
Generosity of the Indians.
New Amstel.
Encroachments of the English.

CHAPTER X.—THE ESOPUS WAR.


Outrage at Esopus.
New Indian War.
Its Desolations.
Sufferings of Both Parties.
Wonderful Energies of the Governor.
Difficulties of his Situation.
The Truce.
Renewal of the War.
The Mohawks.
The Controversy with Massachusetts.
Indian Efforts for Peace.
The Final Settlement.
Claims of the English Upon the Delaware.
Renewed Persecution of the Quakers.

CHAPTER XI.—THE DISASTROUS YEAR.


Purchase of Staten Island.
The Restoration of Charles Second.
Emigration Invited.
Settlement of Bushwick.
The Peculiar People.
Persecution of John Brown.
The Governor Rebuked.
Cumulation of Disasters.
The Outbreak at Esopus.
The Panic.
Measures of the Governor.
The Indian Fort.
The Expedition to Mamaket.
Capture of the Fort.
Annihilation of the Esopus Indians.

CHAPTER XII.—ENCROACHMENTS OF THE ENGLISH.


Annihilation of the Esopus Tribe.
The Boundary Question.
Troubles on Long Island. The Dutch and English Villages.
Petition of the English.
Embarrassments of Governor Stuyvesant.
Embassage to Hartford.
The Repulse.
Peril of New Netherland.
Memorial to the Fatherland.
New Outbreak on Long Island.
John Scott and his Highhanded Measures.
Strengthening the Fortifications.

CHAPTER XIII.—HOSTILE MEASURES COMMENCED.


John Scott and his Movements.
Losses of the Dutch.
The First General Assembly.
Action of the Home Government.
Peace with the Indians.
Arrest of John Scott.
Governor Winthrop's Visit to Long Island.
Sailing of the Fleet.
Preparations for War.
The False Dispatches.
Arrival of the Fleet.
The Summons to Surrender.

CHAPTER XIV.—THE CAPTURE OF NEW AMSTERDAM.


The Approach of the Fleet.
The Governor Unjustly Censured.
The Flag of Truce.
The Haughty Response.
The Remonstrance.
The Defenceless City.
The Surrender.
The Expedition to the Delaware.
Sack and Plunder.
Change of Name.
Testimony to the Dutch Government.
Death of the Governor.
His Farm, or Bouwerie.
War Between Holland and England.
New York Menaced by the Dutch.
CHAPTER XV.—THE FINAL SURRENDER.
The Summons.
The Bombardment.
Disembarkation of the Land Force.
Indecision of Captain Manning.
The Surrender.
Short Administration of the Dutch.
Social Customs.
The Tea Party.
Testimony of Travellers.
Visit to Long Island.
Fruitfulness of the Country.
Exploration of Manhattan Island.

CHAPTER XVI.—THE OLDEN TIME.


Wealth and Rank of the Ancient Families.
Their Vast Landed Estates.
Distinctions in Dress.
Veneration for the Patroon.
Kip's Mansion.
Days of the Revolution.
Mr. John Adams' Journal.
Negro Slavery.
Consequences of the System.
General Panic.
VII. BENJAMIN FRANKLIN

AMERICAN PIONEERS AND PATRIOTS.

Benjamin Franklin.
A PICTURE OF THE
STRUGGLES OF OUR INFANT NATION,
ONE HUNDRED YEARS AGO.

BY
JOHN S. C. ABBOTT.
“Print me as I am.”—Cromwell.
CONTENTS.
CHAPTER I.
Parentage and Early Life.
PAGE
The parentage of Franklin—His
parents emigrate to America—
Character of his father—Abiah Folger,
his mother—Birth and baptism—
Influence of his Uncle Strong—Of the
Whistle—Childish exploits—
Uncongenial employment—Skill in
11
swimming—Early reading—Boston at
that time—An indentured apprentice—
Form of Indenture—Enters a printing
office—Fondness for reading—
Anecdotes—Habits of study—
Fondness for argument—Adopts a
vegetable diet—The two creeds.

CHAPTER II.
Developments of Character.
Views of the Sabbath—Writings of 31
Collins and Shaftsbury—The creed of
Collins—Franklin at sixteen—The
Courant—Denunciations of the paper
—Franklin’s mode of acquiring the art
of composition—His success as a
writer—The Editor prosecuted—
Benjamin becomes Editor and
Publisher—Jealousy of his brother—
The runaway apprentice—The voyage
to New York—Great disappointment—
Eventful Journey to Philadelphia—
Gloomy prospects—The dawn of
brighter days.

CHAPTER III.
Excursion to England.
Attention to dress—Receives a visit
from Gov. Keith—His visit to Boston—
Collins returns to Philadelphia with
him—Sir William Keith’s aid—
Excursions on the Sabbath—Difficulty
with Collins—Spending Mr. Vernon’s 52
money—His three friends—
Engagement with Deborah Read—
Voyage to England—Keith’s deceit—
Ralph—Franklin enters a printing
house in London.

CHAPTER IV.
Mental and Moral Conflicts.
Faithfulness to work—Neglect of
Deborah Read—Treatise on Liberty
and Necessity—Skill in swimming—
Return to America—Marriage of Miss
Read—Severe sickness—Death of Mr. 75
Denham—Returns to Keimer’s employ
—The Junto—His Epitaph—
Reformation of his treatise on Liberty
and Necessity—Franklin’s creed.

CHAPTER V.
The Dawn of Prosperity.
Franklin takes a house—His first job—
His industry—Plans a Newspaper—
Enters the list as a writer—Advocates
a Paper currency—Purchases Keimer’s
paper—Character of Meredith—
Struggles of the firm—Unexpected
assistance—Dissolves partnership with
Meredith—Franklin’s energetic conduct
101
—His courtship, and marriage—
Character of Mrs. Franklin—Increase
of luxury—Plans for a library—
Prosperity of Pennsylvania—Customs
in Philadelphia—Style of dress in 1726
—Franklin’s social position in
Philadelphia—His success—A hard
student.

CHAPTER VI.
Religious and Philosophic Views.
Studious habits—New religion—
Personal habits—Church of the Free
and Easy—His many accomplishments
—The career of Hemphall—Birth and
Death of Franklin’s son—The Ministry
of Whitefield—Remarkable friendship 126
between the philosopher and the
preacher—Prosperity of Franklin—His
convivial habits—The defense of
Philadelphia—Birth of a daughter—The
Philadelphia Academy.

CHAPTER VII.
The Tradesman becomes a Philosopher.
Franklin appointed Indian
commissioner—Effects of Rum—
Indian logic—Accumulating honors—
Benevolent enterprises—Franklin’s
counsel to Tennent—Efforts for city
improvement—Anecdotes—Franklin
appointed postmaster—Rumors of
War—England enlists the Six Nations
in her cause—Franklin plans a 147
Confederacy of States—Plans rejected
—Electrical experiments—Franklin’s
increase of income—Fearful
experiments—The kite—New honors—
Views of the French philosopher—
Franklin’s Religious views—His counsel
to a young pleader—Post-office
Reforms.

CHAPTER VIII.
The Rising Storms of War.
Aristocracy—Anecdote—Conflicting 168
laws of Nations—Franklin’s scheme of
colonization—Proposal of the British
Court—The foresight of Franklin—
Braddock’s campaign—Remonstrances
of Franklin and Washington—
Franklin’s interviews with Braddock—
Franklin’s efficiency—Confidence of
Braddock—The conflict with the
Proprietaries—The non-resistant
Quakers—Fate of the Moravian
villages—The winter campaign—The
camp of Gaudenhutton—Anecdote—
Renewal of the strife with the
Proprietaries—Franklin recalled to
assist the Assembly—Destruction of
the Fort—Claim of the Proprietaries—
The great controversy.

CHAPTER IX.
Franklin’s Mission to England.
New marks of respect—Lord Loudoun
—Gov. Denny and Franklin—Visit the
Indians—Franklin commissioner to
England—His constant good nature—
Loudoun’s delays—Wise action of an
English captain—The voyagers land at
Falmouth—Journey to London—
Franklin’s style of living in London—
His electrical experiments—He
teaches the Cambridge professor— 190
Complimentary action of St. Andrews
—Gov. Denny displaced, and dark
clouds arising—Franklin’s successful
diplomacy—His son appointed
Governor of New Jersey—Great
opposition—The homeward voyage—
Savage horrors—Retaliating cruelties
—Franklin’s efforts in behalf of the
Moravian Indians.

CHAPTER X.
Franklin’s Second Mission to England.
Fiendish conduct of John Penn— 215
Petition to the crown—Debt of
England—Two causes of conflict—
Franklin sent to England—His
embarkation—Wise counsel to his
daughter—The stamp act—American
resolves—Edmund Burke—
Examination of Franklin—Words of
Lord Chatham—Dangers to English
operatives—Repeal of the stamp act—
Joy in America—Ross Mackay—New
taxes levied—Character of George III
—Accumulation of honors to Franklin
—Warlike preparations—Human
conscientiousness—Unpopularity of
William Franklin—Marriage of Sarah
Franklin—Franklin’s varied
investigations—Efforts to civilize the
Sandwich Islands.

CHAPTER XI.
The Intolerance of King and Court.
Parties in England—Franklin the
favorite of the opposition—Plans of
the Tories—Christian III—Letter of
Franklin—Dr. Priestley—Parisian
courtesy—Louis XV—Visit to Ireland—
Attempted alteration of the Prayer
Book—Letter to his son—Astounding
letters from America—Words of John
240
Adams—Petition of the Assembly—
Violent conspiracy against Franklin—
His bearing in the court-room—
Wedderburn’s infamous charges—
Letter of Franklin—Bitter words of Dr.
Johnson—Morals of English lords—
Commercial value of the Colonies—
Dangers threatening Franklin.

CHAPTER XII.
The Bloodhounds of War Unleashed.
The mission of Josiah Quincy—Love of
England by the Americans—Petition to
the king—Sickness and death of Mrs.
Franklin—Lord Chatham—His speech
in favor of the colonists—Lord Howe—
His interview with Franklin—Firmness
of Franklin—His indignation—His mirth
—Franklin’s fable—He embarks for 265
Philadelphia—Feeble condition of the
colonies—England’s expressions of
contempt—Franklin’s reception at
Philadelphia—His letter to Edmund
Burke—Post-office arrangements—
Defection and conduct of William
Franklin—His arrest.

CHAPTER XIII.
Progress of the War, both of Diplomacy and
the Sword.
Letter of Henry Laurens—Franklin
visits the army before Boston—Letter
of Mrs. Adams—Burning of Falmouth
—Franklin’s journey to Montreal—The
Declaration of Independence—
Anecdote of the Hatter—Framing the
292
Constitution—Lord Howe’s Declaration
—Franklin’s reply—The Conference—
Encouraging letter from France—
Franklin’s embassy to France—The
two parties in France—The voyage—
The reception in France.

CHAPTER XIV.
The Struggles of Diplomacy.
Anecdote of Gibbon—John Adams—
Residence at Passy—Lafayette
introduced—Cruise of the Reprisal—
Paul Jones—Capture of Burgoyne—
Alliance with France—Anecdote of the
Cake—Excitement in England—
Franklin’s introduction to the king—Joy
in America—Extraordinary letter of
Count Wissenstein—The reply—
322
Injustice to Paul Jones—French troops
in America—Character of John Adams
—Franklin’s mature views of human
nature—Anecdote of the Angel—
Capture of Cornwallis—Its effect in
England—Prejudices of Mr. Jay—
Testimony of Dr. Sparks—Jealousy of
Franklin—Shrewd diplomatic act—The
treaty signed.

CHAPTER XV.
Life’s Closing Scenes.
Advice to Thomas Paine—Scenes at
Passy—Journey to the Coast—Return
to America—Elected Governor of
Pennsylvania—Attends the
356
Constitutional Convention—Proposes
prayers—Remarkable speech—Letter
to Dr. Stiles—Christ on the Cross—Last
sickness and death.
VIII. GEORGE WASHINGTON
AMERICAN PIONEERS AND PATRIOTS.

George Washington;
OR,
Life in America One Hundred
Years Ago.
BY
JOHN S. C. ABBOTT.
CONTENTS
PAGE
PREFACE. 3
CHAPTER I.
The Youth of George Washington. 9
CHAPTER II.
The First Military Expedition. 44
CHAPTER III.
The French War. 78
CHAPTER IV.
The Warrior, the Statesman, and the Planter. 108
CHAPTER V.
The Gathering Storm of War. 138
CHAPTER VI.
The Conflict Commenced. 170
CHAPTER VII.
Progress of the War. 202
CHAPTER VIII.
The Siege of Boston. 232
CHAPTER IX.
The War in New York. 264
CHAPTER X.
The Vicissitudes of War. 295
CHAPTER XI.
The Loss of Philadelphia, and the Capture of Burgoyne. 325
CHAPTER XII.
Concluding Scenes. 341
IX. DANIEL BOONE

DANIEL BOONE
THE
PIONEER OF KENTUCKY.

BY
JOHN S. C. ABBOTT.
CONTENTS.
CHAPTER I.
The Discovery and early Settlement of America.
Discovery of the New World.—Of Florida.—Conquest and cruelties
of De Soto.—The Wigwam.—Colony at St. Mary.—Sir Walter Raleigh
and his Colonies.—Grant of King James.—Settlements in the Virginia.
—Adventures of John Smith.—Arrival of Lord Delaware.—Terrible
massacres.—Pressures of Colonists to the West.—Doherty Trade with
Indians.—Attempted Colony on the Tennessee.—Daniel Boone. Page
9
CHAPTER II.
Daniel Boone, his Parentage, and early Adventures.
Trials of the Colonists.—George Boone and his home.—Squire
Boone.—Birth and character of Daniel Boone.—His limited education.
—A pioneer's camp.—A log house and furnishings.—Annoyance of
Boone on the arrival of Scotch emigrants.—His longings for
adventure.—Camp meetings.—Frontier life.—Sports.—Squirrel
hunting.—Snuffing the candle. 36
CHAPTER III.
Louisiana, its Discovery and Vicissitudes.
Louisiana, and its eventful history.—The expedition of De Soto.—
The Missionary Marquette.—His voyage on the Upper Mississippi.—
The Expedition of La Salle.—Michilimackinac.—Its History.—Fate of
the "Griffin."—Grief of La Salle.—His voyage of Discovery.—Sale of
Louisiana to the United States.—Remarks of Napoleon. 74
CHAPTER IV.
Camp Life Beyond the Alleghanies.
John Finley and his adventures.—Aspect of the Country.—Boone's
Private Character.—His Love for the Wilderness.—First view of
Kentucky.—Emigrants' Dress.—Hunter's Home.—Capture of Boone
and Stewart by the Indians.—Their Escape.—Singular Incident. 89
CHAPTER V.
Indian Warfare.
Alleghany Ridges.—Voyage in a canoe.—Speech of Logan.—Battle
at the Kanawha.—Narrative of Francis Marion.—Important
commission of Boone.—Council at Circleville.—Treaty of Peace.—
Imlay's description of Kentucky.—Settlement right.—Richard
Henderson.—Boone's letter.—Fort at Boonesborough. 109
CHAPTER VI.
Sufferings of the Pioneers.
Emigration to Boonesborough.—New Perils.—Transylvania
Company.—Beneficence of its Laws—Interesting incident.—Infamous
conduct of Great Britain.—Attack on the Fort.—Reinforcements.—
Simon Kenton and his Sufferings.—Mrs. Harvey. 129
CHAPTER VII.
Life in the Wilderness.
Stewart killed by the Indians.—Squire Boone returns to the
Settlements.—Solitary Life of Daniel Boone.—Return of Squire
Boone.—Extended and Romantic Explorations.—Charms and Perils of
the Wilderness.—The Emigrant Party.—The Fatal Ambuscade.—
Retreat of the Emigrants.—Solitude of the Wilderness.—Expedition of
Lewis and Clarke.—Extraordinary Adventures of Cotter. 151
CHAPTER VIII.
Captivity and Flight.
Heroism of Thomas Higgins and of Mrs. Pursley.—Affairs at
Boonesborough.—Continued Alarms.—Need of Salt.—Its
Manufacture.—Indian Schemes.—Capture of Boone and twenty-
seven men.—Dilemma of the British at Detroit.—Blackfish adopts
Colonel Boone.—Adoption Ceremony.—Indian Designs.—Escape of
Boone.—Attacks the Savages.—The Fort Threatened. 182
CHAPTER IX.
Victories and Defeats.
Situation of the Fort.—Indian Treachery.—Bombardment.—Boone
goes to North Carolina.—New Trials.—Boone Robbed.—He returns to
Kentucky.—Massacre of Colonel Rogers.—Adventure of Col. Bowman.
—New Attack by the British and Indians.—Retaliatory Measures.—
Wonderful Exploit. 209
CHAPTER X.
British Allies.
Death of Squire Boone.—Indian Outrages.—Gerty and McGee.—
Battle of Blue Lick.—Death of Isaac Boone.—Colonel Boone's Narrow
Escape.—Letter of Daniel Boone.—Determination of General Clarke.
—Discouragement of the Savages.—Amusing Anecdote of Daniel
Boone. 230
CHAPTER XI.
Kentucky organized as a State.
Peace with England.—Order of a Kentucky Court.—Anecdotes.—
Speech of Mr. Dalton.—Reply of Piankashaw.—Renewed Indications
of Indian Hostility.—Conventions at Danville.—Kentucky formed into
a State.—New Trials for Boone. 249
CHAPTER XII.
Adventures Romantic and Perilous.
The Search for the Horse.—Navigating the Ohio.—Heroism of Mrs.
Rowan.—Lawless Gangs.—Exchange of Prisoners.—Boone Revisits
the Home of his Childhood.—The Realms beyond the Mississippi.—
Habits of the Hunters.—Corn.—Boone's Journey to the West. 271
CHAPTER XIII.
A New Home.
Colonel Boone welcomed by the Spanish Authorities.—Boone's
Narrative to Audubon.—The Midnight Attack.—Pursuit of the
Savages.—Sickness in the Wilderness.—Honesty of Colonel Boone.—
Payment of his Debts.—Loss of all his Property. 292
CHAPTER XIV.
Conclusion.
Colonel Boone Appeals to Congress.—Complimentary Resolutions
of the Legislature of Kentucky.—Death of Mrs. Boone.—Catholic
Liberality.—Itinerant Preachers.—Grant by Congress to Colonel
Boone.—The Evening of his Days.—Personal Appearance.—Death
and Burial.—Transference of the Remains of Mr. and Mrs. Boone to
Frankfort, Kentucky. 320

X. CHRISTOPHER CARSON

AMERICAN PIONEERS AND PATRIOTS


CHRISTOPHER CARSON
FAMILIARLY KNOWN

AS

KIT CARSON
The Pioneer of the West.

BY

JOHN S. C. ABBOTT
WITH ILLUSTRATIONS BY ELEANOR GREATOREX
CONTENTS.
PREFACE.
CONTENTS.
CHAPTER I.
Early Training.
Page
Birth of Christopher Carson.—Perils of the
Wilderness.—Necessary Cautions.—
Romance of the Forest.—The Far West.—
The Encampment.—The Cabin and the
Fort.—Kit an Apprentice.—The Alarm.—
9
Destruction of a Trading Band.—The
Battle and the Flight.—Sufferings of the
Fugitives.—Dreadful Fate of Mr. Schenck.
—Features of the Western Wilderness.—
The March.
CHAPTER II.
Life in the Wilderness.
A Surgical Operation.—A Winter with Kin
Cade.—Study of the Languages and
Geography.—Return towards Missouri.—
Engagement with a new Company and
Strange Adventures.—The Rattlesnake.—
Anecdote of Kit Carson.—The Sahara.— 29
New Engagements.—Trip to El Paso.—
Trapping and Hunting.—Prairie Scenery.—
The Trapper's Outfit.—Night
Encampment.—Testimony of an Amateur
Hunter.
CHAPTER III.
Among the Trappers.
The Discomfited Trappers.—The New
Party Organized.—A Battle with the
Indians.—Trapping on the Colorado.—
March to the Sacramento.—The Friendly
Indians.—Crossing the Desert.—Instinct
of the Mule.—The Enchanting Valley of
the Colorado.—The Mission of San
51
Gabriel.—Vast Herds of Cattle.—The
Mission of San Fernando.—Adventures in
the Valley of San Joaquin.—The Meeting
of two Trapping Bands.—Reasons for Kit
Carson's Celebrity.—A Military Expedition.
—The Indian Horse Thieves.—The Pursuit
and Capture.
CHAPTER IV.
Conflicts with the Indians.
The American Trapper.—The Trapper of
the Hudson's Bay Company.—The Return
Trip.—Polished Life in the Wilderness.—
The Spanish Gentlemen.—Council of the
Trappers.—Self-possession of Kit Carson.
—The Camp Cleared of Intruders.— 72
Robbing the Robbers.—Sale of the Furs.—
Mr. Fitzpatrick's Expedition.—Pains and
Pleasures of Rocky Mountain Life.—
Pursuit of Indian Horse Thieves.—
Extraordinary Battle.
CHAPTER V.
Marches and Encampments.
The Encampment Among the Rocky 94
Mountains.—The Attempted Stampede.—
Retreat and Pursuit by the Savages.—The
Alarm.—Loss of the Horses.—Their
Recovery.—Enterprise of Kit Carson.—
Fight with the Indians.—The Litter for the
Wounded.—Union of the two Trapping
Parties.—Successful Return to Taos.—
Carson joins a Trading Party.—Chivalric
Adventures.—Attacked by Bears.
CHAPTER VI.
The Rendezvous.
Fair in the Wilderness.—The
Encampment.—Dispersion of the
Trappers.—Hostility of the Blackfeet.—
Camp on the Big Snake River.—The
Blackfeet Marauders.—The Pursuit.—The
121
Calumet.—The Battle.—Kit Carson
wounded.—The Rencontre with Shunan.—
The Defeat and Humiliation of Shunan.—
Remarkable Modesty of Carson.—
Testimony to Mr. Carson's Virtues.
CHAPTER VII.
War with the Blackfeet Indians.
Unsuccessful Trapping.—Disastrous March
to Fort Hall.—The Feast upon Horse-flesh.
—The Hunting Expedition.—Its Rare
Attractions.—Dogged by the Blackfeet.—
Safe Arrival at the Fort.—All their Animals
Stolen by the Indians.—Expedition to the 141
Blackfeet Country.—Winter Quarters with
the Friendly Indians.—Sufferings of the
Animals.—Return to the Blackfeet
Country.—Battle with the Indians.—
Incidents of the Battle.
CHAPTER VIII.
Encampments and Battles.
The Renewal of the Battle.—Peculiarities 160
of the Fight.—The Rout.—Encampment in
the Indian Village.—Number of Trappers
among the Mountains.—The New
Rendezvous.—Picturesque Scene of the
Encampment.—The Missionary and the
Nobleman.—Brown's Hole.—The
Navajoes.—Kit Carson Purveyor at the
Fort.—Trapping at the Black Hills.—Again
upon the Yellowstone.—Pleasant Winter
Quarters.—Signs of the Indians.—Severe
Conflict.—Reappearance of the Indians.—
Their utter Discomfiture.
CHAPTER IX.
The Trapper's Elysium.
Trapping on the Missouri.—Attacked by
the Blackfeet.—The Battle.—Persevering
Hostility of the Indians.—The Trappers
driven from the Country.—Repair to the
North Fork.—Cheerful Encampments.—
Enchanting Scene.—Village of the
Flatheads.—The Blessings of Peace.—
179
Carson's Knowledge of Languages.—
Pleasant Winter Quarters on the Big
Snake River.—Successful Trapping.—
Winter at Brown's Hole.—Trip to Fort
Bent.—Peculiar Characters.—Williams and
Mitchel.—Hunter at Fort Bent.—Marriage.
—Visit to the States.
CHAPTER X.
Fremont's Expedition.
Carson's Visit to his Childhood's Home.— 197
On the Steamer.—Introduction to
Fremont.—Object of Fremont's
Expedition.—Joins the Expedition.—
Organization of the Party.—The
Encampment.—Enchanting View.—
Fording the Kansas.—The Stormy Night.—
The Boys on Guard.—The Alarm.—The
Returning Trappers.—The Homeless
Adventurer.—Three Indians join the Party.
—First sight of the Buffaloes.—The Chase.
CHAPTER XI.
The Return of the Expedition.
Beautiful Prairie Scene.—Fate of the
Buffalo Calf.—Vast Buffalo Herds.—The
Fourth of July on the Plains.—Journey up
the South Fork of the Platte.—Visit to Fort
St. Vrain.—Remonstrance of the Chiefs.—
Second Marriage of Mr. Carson.—New
Engagements.—Perilous Ride to Santa Fe. 217
—The Successful Mission.—The Noble
Mexican Boy.—Conflict with the Savages.
—Discomfiture of the Indians.—Fremont's
Second Expedition.—Carson joins the
Party.—Course of the Expedition.—Arrival
at the Great Salt Lake.
CHAPTER XII.
Marches and Battles.
Entering the Lake.—Dangerous
Navigation.—The Return to Camp.—Feast
upon Horse Flesh.—Meeting the Indians.
—Joyful Meeting.—Return to Fort Hall.—
Feasting at the Fort.—The Party
Diminished.—The Journey down Snake
River.—Crossing the Sierra Nevada.—
236
Carson Rescues Fremont.—Fort Sutter.—
Heroic Achievement of Carson.—
Disbanding the Party.—The third
Expedition.—Crossing the Desert.—
Threatened by the Mexicans.—Fight with
the Indians.—The Surprise.—
Chastisement of the Indians.
CHAPTER XIII.
The Dispatch Bearer.
Colonel Fremont.—Hazardous
Undertaking of Kit Carson.—Carson's
Courage and Prudence.—Threatened
Danger.—Interview with General Kearney,
and Results.—Severe Skirmish.— 255
Wonderful Escape of Carson.—Daring
Adventure.—Fearful Suffering.—
Lieutenant Beale.—Carson's Journey to
Washington.—Adventures on his Return.
CHAPTER XIV.
The Chivalry of the Wilderness.
Injustice of the Government.—Heroic
Resolve of Mr. Carson.—Indian Outrages.
—The valley of Razado.—Barbaric
Murders by Apaches.—An Exciting Chase.
272
—An Attractive Picture.—Plot of Fox
Overthrown.—Gift of Messrs. Brevoort
and Weatherhead.—Adventure with the
Cheyennes.
CHAPTER XV.
Recollections of Mountain Life.
Character of the Native Indian.—The
Caravan.—Interesting Incident.—Effects
of Cholera.—Commission of Joe Smith.—
Snow on the Mountains.—Government
Appointment.—Adventure with three
286
Bears.—Journey to Los Angelos.—Mt. St.
Bernardino.—The Spring.—Character of
Men.—Insubordination Quelled.—
Suffering for Water and Relief.—A Talk
with Indians.
CHAPTER XVI.

You might also like