Programming In C EST 102 1st Edition Jayaraj V S instant download
Programming In C EST 102 1st Edition Jayaraj V S instant download
install download
https://ebookmeta.com/product/programming-in-c-est-102-1st-
edition-jayaraj-v-s/
https://ebookmeta.com/product/analog-integrated-circuits-and-
simulation-lab-manual-ecl331-1st-edition-v-s-jayaraj/
https://ebookmeta.com/product/computer-graphics-programming-in-
opengl-with-c-2nd-edition-v-scott-gordon/
https://ebookmeta.com/product/programming-in-c-third-edition-
kamthane/
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/
https://ebookmeta.com/product/schwesernotes-2023-level-ii-cfa-
book-5-portfolio-management-and-ethical-and-professional-
standards-1st-edition-kaplan-schweser/
https://ebookmeta.com/product/servant-for-an-alien-leader-
intergalactic-exchange-program-8-1st-edition-roxie-ray-ray/
https://ebookmeta.com/product/advertising-and-consumer-
society-2nd-edition-nicholas-holm/
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
Jayaraj V S
Sivapriya P M
Programming In C
EST-102
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
Module II
Brief History of C Programming Language 35
2.1 Basic structure of C program 38
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
Module III
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.
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
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.
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.
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
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
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.
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.
Debugging and maintenance are not Debugging and maintenance are easier in a high-
easier in a low-level language. level language.
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.
Examples C, COBOL, C#, C++, etc Python, VB, Java Script etc.
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.
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.
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.
19
Input/ Output Used for denoting program inputs and
outputs.
20
Examples of flowcharts in programming
1. Add two numbers entered by the user.
21
3. Find the factorial of a number entered by user.
22
5. Find the Fibonacci series till the term N.
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
24
...
ENDFOR
Example: Print n natural numbers
BEGIN
GET n
INITIALIZE i=1
FOR (i<=n) DO
PRINT i
i=i+1
ENDFOR
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
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
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
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.
31
Exploring the Variety of Random
Documents with Different Content
Outrage upon the Raritan Indians.
Indian Revenge.
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
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.