[ 01.html ]
. . . . . . . . . ( end of section Admin) <<Contents | End>>
Computers are dumb.
They do precisely what we tell them to, step by step, exactly as they have been told.
So we have to tell them what to do..... in detail.
Computers are dumb -- we have to be smart to make them useful.
To be able to tell them what to do correctly you have to understand how they work.
Solving people's problems, exploring new ideas, .... , finding out what
is wrong and fixing it.
Some of the things that your programs will do won't make sense unless you
grasp these facts.
NO. I am not this old. :-)
My Ph.D. Supervisor worked on the Brittish EDSAC and my father on TRIDAC (3
D simulations of planes and missiles). And in England one of the first generation machines
[ technology-20395212 ]
the WITCH is still running...
Life has got easier since we made the computer translate high level
languages into machine code for us.
We cover 10 languages in 10 weeks in
[ ../cs320 ]
but in this class all we need is to master the simpler parts of C++.
Once you have got the ideas and syntax of C++ you will find nearly any other
language easier to learn -- the exceptions are in CSCI320.
What Lab 01 and 02 are about.
Keep a back up copy of all your data.
Memorize this ... or make yourself a blank program that you can copy.
Sad but true -- missing a ";" is a common error.
Almost as common as putting a ";" in the wrong place.
One of the hardest parts of programming is accepting that we all make mistakes.
Correct spelling is important for wizards.
For most of the programs you will write in cs201 you can type this
into a terminal window:
Here is a sample algorithm
[ 02example.html ]
[ 02example.cpp ]
a rough translation into C++.
We can use the CodPad site
[ http://codepad.org/ ]
to check the program for errors.
In this class there will be programming projects. You should
first write an algorithm. Put it in your program file
before you add the C++ code:
end Algorithm */
For example see
[ project.cpp ]
which is a good place to start the projects in this class.
Note: In many applications we don't need a complex algorithm but we do need
to understand what the user wants and how they can get it. For example
This is called a "use case" and in this class can be put at the start of
the program to document it's purpose. For example,
[ 02ex0.cpp ]
- The user wants the computer to calculate the square root of a positive number.
- Main Scenario
- The user inputs a positive number.
- The computer outputs the sqare root.
- Extension 1a
- The user inputs a number less than zero,
- The computer outputs an eror message.
Do as many of the review exercises on pages 27 thru to 29 as you have time
for. Hand in a copy of one question and your answer on a piece of paper
with your name on it for me to grade at the
start of the class.
[ 02exalg.html ]
is the algorithm from section 1.11 in the text book. Try executing it by hand.
Here is the example algorithm
[ 02example.html ]
, follow it, starting with number set to any positive whole number you like. You
may use a calulator. You should use paper and pencil. Work out step by step
what it does with your starting value.
- What does this
[ 02ex1.cpp ]
display when compiled and run in our lab or on Codepad? Work it out by hand!
. . . . . . . . . ( end of section Exercises) <<Contents | End>>
[ 03.html ]
[ lab01/ ]
Algorithm::=A precise description of a series of steps to attain a goal,
[ Algorithm ]
Class::=A description of a type of object that includes the data it knows and the functions it can execute.
Function::programming=A selfcontained and named piece of program that knows how to do something.
Gnu::="Gnu's Not Unix", a long running open source project that supplies a
very popular and free C++ compiler.
Current paradigm for programming.
Semantics::=Rules determining the meaning of correct statements in a language.
a previous paradigm for programming.
Syntax::=The rules determining the correctness and structure of statements in a language, grammar.
Q::software="A program I wrote to make software easier to develop",
TBA::="To Be Announced", something I should do.
TBD::="To Be Done", something you have to do.
UML::="Unified Modeling Language", industry standard design and documentation diagrams.
void::C++Keyword="Indicates a function that has no return value".