Links to the basic examples of computer programs

The table below contains all programs that are presented in the programming books by Kari Laitinen.
In addition there are links to extra programs that are available, but not presented in the books.
To view these programs with an Internet browser, it is best to install the Mozilla Firefox browser which
shows the programs in a browser window. (Another page lists  programs that provide a Graphical User Interface.)
© 2006-2009 Kari Laitinen 

 
  Java C# C++ (See footnote a.) Python
First look at source programs in Chapter 2. First.java
Sum.java
SumImproved.java
First.cs
Sum.cs
SumImproved.cs
first.cpp
sum.cpp
sum_improved.cpp
First.py
Sum.py
SumImproved.py
Simple programs that calculate, read numerical values from the keyboard, and print information to the screen. (Chapter 5) Game.java
Miles.java
Distance.java
Additions.java
Formatting.java
Game.cs
Miles.cs
Distance.cs
Additions.cs
Formatting.cs
game.cpp
miles.cpp
distance.cpp
Additions.cpp
Formatting.cpp
Game.py
Miles.py
Distance.py
Additions.py
Formatting.py
Programs that demonstrate various if constructs and switch-case constructs. (Chapter 6) Largeint.java
Evenodd.java
Likejava.java
Iffing.java
Likejavas.java
Sentence.java
Largeint.cs
Evenodd.cs
Likecs.cs
Iffing.cs
Likecss.cs
Sentence.cs
largeint.cpp
evenodd.cpp
likecpp.cpp
ifascii.cpp
likecpps.cpp
sentence.cpp
Largeint.py
Evenodd.py
Likepython.py
Iffing.py
Likepythons.py
Sentence.py
Loops. (Chapter 6) While20.java
Whilesum.java
For20.java
Forcodes.java
Meanvalue.java
Words.java
MeanvalueException.java
TruthValues.java
While20.cs
Whilesum.cs
For20.cs
Forcodes.cs
Meanvalue.cs
Words.cs
MeanvalueException.cs
TruthValues.cs
while20.cpp
whilesum.cpp
for20.cpp
forascii.cpp
meanvalue.cpp
words.cpp
MeanvalueException.cpp
truth.cpp
While20.py
Whilesum.py
For20.py
Forcodes.py
Meanvalue.py
Words.py
MeanvalueException.py
TruthValues.py
Arrays. (Chapter 7) ArrayDemo.java
Reverse.java
MeanvalueArray.java
Celsius.java
Interest.java
ArrayDemo.cs
Reverse.cs
MeanvalueArray.cs
Celsius.cs
Interest.cs
array.cpp
reverse.cpp
meanvalue_array.cpp
celsius.cpp
interest.cpp
ArrayDemo.py
Reverse.py
MeanvalueList.py
Celsius.py
Interest.py
Strings. (Chapter 8) Fullname.java
Widename.java
StringReverse.java
StringEquality.java
Marilyn.java
StringMethodsMore.java
States.java
Stringing.java
Capitals.java
Elvis.java
StatesStringBuilder.java
Months.java
SplittingAtoms.java
Fullname.cs
Widename.cs
StringReverse.cs
StringEquality.cs
Marilyn.cs
StringMethodsMore.cs
States.cs
Stringing.cs
Capitals.cs
Elvis.cs
StatesStringBuilder.cs
Months.cs
SplittingAtoms.cs
fullname.cpp
widename.cpp
string_reverse.cpp
StringEquality.cpp
marilyn.cpp
string_functions_more.cpp
states.cpp
stringing.cpp
capitals.cpp
elvis.cpp
string_copying.cpp
string_functions.cpp
Fullname.py
Widename.py
StringReverse.py
StringEquality.py
Marilyn.py
StringManipulationsMore.py
States.py
Stringing.py
Capitals.py
Elvis.py
StatesList.py
Months.py
SplittingAtoms.py
Pointers. (Chapter 8 in the C++ book)     addresses.cpp
pointer_simple.cpp
pointer_arithmetics.cpp
pointer_arrays.cpp
string_pointing.cpp
string_pointing_more.cpp
months.cpp
memory.cpp
 
Static methods (functions) and the concept of calling. (Chapter 9) Messages.java
Letters.java
Sums.java
Decorations.java
LargestWithReturn.java
MeanvalueMethod.java
Sort.java
ScopeExploration.java
Commanding.java
Calculate.java
Overload.java
Messages.cs
Letters.cs
Sums.cs
Decorations.cs
Largest.cs
LargestWithRef.cs
LargestWithReturn.cs
MeanvalueMethod.cs
Sort.cs
StackInspection.cs
ScopeExploration.cs
Commanding.cs
Calculate.cs
Overload.cs
messages.cpp
letters.cpp
sums.cpp
decorations.cpp
largest.cpp
largest_with_return.cpp
meanvalue_function.cpp
sort.cpp
stack_exploration.cpp
scope.cpp
commanding.cpp
calculate.cpp
overload.cpp
Messages.py
Letters.py
Sums.py
Decorations.py
LargestReturned.py
MeanvalueFunction.py
SortMain.py
InputOutput.py
Sort.py
ScopeExploration.py
Commanding.py
Calculate.py
Overload.py
C++ structs. Chapter 10 in the C++ book.     person.cpp
olympics.cpp
convert.cpp
planets.cpp
collect.cpp
 
Classes and objects: these programs demonstrate class declarations, object creations, and arrays of objects. Rectangles.java
BankSimple.java
Person.java
BankBetter.java
Animals.java
Olympics.java
Convert.java
Planets.java
Stack.java
Rectangles.cs
BankSimple.cs
Person.cs
BankBetter.cs
Animals.cs
Olympics.cs
Convert.cs
Planets.cs
Stack.cs
Rectangles.cpp
bank_simple.cpp
person.cpp
bank_better.cpp
animals.cpp
OlympicsObjectOriented.cpp
ConvertObjectOriented.cpp
PlanetsObjectOriented.cpp
useful_constants.h
winter_olympics.cpp
free_store.cpp
bank_pointers.cpp
stack.cpp
Rectangles.py
BankSimple.py
Person.py
BankBetter.py
Animals.py
Olympics.py
Convert.py
Planets.py
Stack.py

More advanced classes.


Columbus.java

Birthdays.java
Friday13.java
Date.java
Presidents.java
LargestWithIntParameter.java


Columbus.cs

Birthdays.cs
Friday13.cs
Date.cs
Presidents.cs
stringadding.cpp
class_simple_string.h
columbus.cpp
birthdays.cpp
friday13.cpp
class_date.h
presidents.cpp



Columbus.py

Birthdays.py
Friday13.py
ISODate.py   Date.py
Presidents.py
LargestWithIntParameter.py
Properties and indexers (in C# classes.)   WinterOlympics.cs
DynamicArray.cs
Unabbreviator.cs
   
C# structs   RectanglesWithStruct.cs
BankSimpleWithStruct.cs
BankBetterWithStruct.cs
   
Templates for functions and classes (in C++.)     useful_functions.h
stack_template.cpp
 
Inheritance and class hierarchies. BetterDate.java
CurrentDate.java
Titanic.java
Weddingdates.java
Calendars.java
Highmiddlelow.java
Windows.java
BankPolymorphic.java
Times.java
BetterDate.cs
CurrentDate.cs
Titanic.cs
Weddingdates.cs
Calendars.cs
Highmiddlelow.cs
Windows.cs
BankVirtuals.cs
Times.cs
better_date.cpp
class_current_date.h
titanic.cpp
weddingdates.cpp
calendars.cpp
highmiddlelow.cpp
windows.cpp
bank_virtuals.cpp
times.cpp
BetterDate.py
CurrentDate.py
Titanic.py
Weddingdates.py
Calendars.py
Highmiddlelow.py
Windows.py
BankPolymorphic.py
Times.py
Exception classes and other fundamental classes. Boxings.java
ExceptionalNumbers.java
MathDemo.java
Boxing.cs
ExceptionalNumbers.cs
ArrayMethods.cs
MathDemo.cs
ExceptionalNumbers.cpp
MathDemo.cpp
Boxings.py
ExceptionalNumbers.py
MathDemo.py
Storing information in files: These examples demonstrate how programs can read information from files and how programs can write information to files. Files can be treated as text files or binary files. Fileput.java
Fileprint.java
Filecopy.java
Search.java
Findreplace.java
FileToNumbers.java
NumbersToFile.java
Collect.java
Showfile.java
Encrypt.java
Decrypt.java
DateToJPGFileNames.java
Fileput.cs
Fileprint.cs
Filecopy.cs
Search.cs
Findreplace.cs
FileToNumbers.cs
NumbersToFile.cs
Collect.cs
Showfile.cs
Encrypt.cs
Decrypt.cs
DateToJPGFileNames.cs
fileput.cpp
fileprint.cpp
filecopy.cpp
search.cpp
findreplace.cpp
FileToNumbers.cpp
NumbersToFile.cpp
CollectObjectOriented.cpp
showfile.cpp
encrypt.cpp
decrypt.cpp
Fileprint.py
Filecopy.py
Search.py
Findreplace.py
FileToNumbers.py
NumbersToFile.py
Collect.py
Dynamic arrays and lists: dynamic arrays grow automatically as necessary. ArrayListDemo.java
MorseCodes.java
Translate.java
Events.java
ArrayListMethods.cs
MorseCodes.cs
Translate.cs
Events.cs
vectoring.cpp
translate.cpp
events.cpp
ArrayListDemo.py
MorseCodes.py
Translate.py
Events.py
Standard mechanisms to handle time and date information. BirthdaysGregorianCalendar.java
Friday13GregorianCalendar.java
Showtime.java
BirthdaysDateTime.cs
Friday13DateTime.cs
Showtime.cs
showtime.cpp BirthdaysStandard.py
Friday13Standard.py
Showtime.py
Bitwise operators. Uplow.java
Binary.java
Uplow.cs
Binary.cs
uplow.cpp
binary.cpp
Uplow.py
Binary.py
Threads: independent subprocesses within a program. Sleepings.java
DotsAndDollars.java
Playtime.java
Clock.java
Sleepings.cs
DotsAndDollars.cs
Playtime.cs
Clock.cs
playtime.cpp
clock.cpp
(These C++ programs are implemented without threads.)
Sleepings.py
DotsAndDollars.py
Playtime.py
Clock.py
Larger programs. Chapter 16 in the C++ book.     editor1.cpp
travel.cpp
travel_database.cpp
travel_database_initial_data.h
class_text.h
class_place_on_earth.h
class_travel_application.h
class_travel_database_...h
 
Folders (directories) containing extra programs not presented in the books. Extra Java programs Extra C# programs Extra C++ programs Extra Python programs
Folders (directories) containing solutions to programming exercises. Solutions to Java exercises Solutions to C# exercises There are not solutions to all C++ exercises. The extra C++ programs folder contains some solutions.  
.ZIP files ALL_JAVA_FILES_ETC.ZIP ALL_CS_FILES_ETC.ZIP ALL_CPP_FILES_ETC.ZIP ALL_PYTHON_FILES.ZIP
Book homepages Homepage of the Java book Homepage of the C# book Homepage of the C++ book Python page

To www.naturalprogramming.com main page

Examples of programs that provide a Graphical User Interface.

a) The C++ programs listed on this page are written so that the #include command
#include <iostream.h>
is in use. Because using include commands such as this one is a somewhat "old-fashioned" way to write C++ programs, some C++ compilers may print warning messages when you compile these programs. The free Borland C++ compiler does not produce these warnings, but, for example, the C++ compiler in Macintosh does. Despite of these warnings, these programs should work well. If you want to get rid of these warnings, you should replace the above #include command with the program lines
#include <iostream>
using namespace std ;
As you can see, you need to add a new program line in order to modernize these programs. The reason why I have used the "old-fashioned" #include commands in these programs is that this way the programs could be made somewhat shorter. I also thought that the "using" statements might confuse beginners who are learning the basics of computer programming. More information about the "using" statements and namespaces can be found on page 267 of the C++ book. I have not, yet, modernized these programs because if these programs are changed, the entire C++ book needs to be modified and updated, which is a somewhat complicated task. The "old-fashioned" #include commands should not prevent you from efficiently learning the basics of programming, but, I admit, they may annoy you when you become more experienced in C++ programming.

2014-01-10  Last modification of this page