Introduction to
Computer Science
CSCI 105 Fall semester, 2009
To the Bottom of the Page
Instructor:
Dr. Shieu-Hong
Lin
Email: 
Class: Section 1: 11:30-12:20; Mon. Wed. at LIBR L141, Fri.
at Rood 51 TA: Philip Myers
Section 2: 12:30-1:20;
Mon. Wed. at LIBR L141, Fri.
at Rood 51 TA: Godestablishedyou
Escobedo
Dr. Lin Office
Hours: Mon. & Wed. 2:00-4:00 pm, Math & CS department
TA hours: To be announced.
Syllabus
About weekly progress report:
(Download this template)
By Wednesday each week, you should spend around 5~10
minutes to
- Add the latest progress made (from last Wednesday to this Wednesday)
into the report, and
- email the report to Dr. Lin.
About programming:
Intro to how to compile your C++
programs (with a sample
Visual C++ project for a sample C++ program)
Grading policy
on programming assignments
For each
programming assignment, you should email your source code .cpp
file to our class TAs (Section 1: Philip Myers, Section
2: Godestablishedyou Escobedo.)
Microsoft Visual C+++ 2008
Express Edition
*************************************************************************************************
Week 1: Overview. Weekly progress report due: Wednesday, Sept. 2.
- Reading
#1: Read sections
2.1 ~ 2.6 and section 2.8 of the textbook and try to understand
this very simple C++ program.
- Lab #1:
Based on Reading #1 and your
understanding of the very simple sample program
above, try to write your own C++ program that asks the user to provide a
distance in inches, covert that into a distance in cm, and
inform the user of the result. Write down your code as a text file in
Notepad and also enclose the contents in your progress report to me. Keep
the text file with you and we will help you compile and run your program
on Monday in the lab. (This is not a programming assignment. You do not
need to compile it, nor need to send it to the TA.)
- Computer
Science showcase #1 (What makes a very
simple computer application program?) (i)
Download and extract this compressed visual C++
project folder to get a program folder (a sample folder
of files including sample.cpp that
contains source code written in C++, sample.sln
that defines the programming project and other project
related files) with a simple windows console interface. (ii) Open the
folder and double click sample.sln
to open the entire program as a Microsoft C++ programming project
under Microsoft Visual C++ environment. Browse the files to see the C++
source code in sample.cpp. Press Ctrl
+ F5 to run the program. Or alternatively go to the menu bar by Debug
--> Start without Debugging to run the program. Play with the
program to see its functionality. (iii) Close the Microsoft C++
programming project. Go to the sample folder again
and find a Debug folder in it. Open the Debug
folder and double click a sample.exe file in it. This is the
executable compiled from the many source code files in the sample
folder by the Microsoft C++ programming environment. The end users
typically run this executable directly without the original source code
written by the programmers.
Week 2: Basics of
variables, types, operators, and expressions. Progress
report due: Wednesday, Sept. 9
- Reading #2: Read Sections 2.7,
2.9, 2.11~2.15, 3.1~3.2 of the textbook.
- Programming Assignment #0 (Using double variables and simple
input/output and assignment statements): Due: Wednesday,
Sept. 9.
(i) Read this introductory tutorial on how to compile your
C++ programs. Download this zipped sample Visual C++ project,
extract it to get a Visual C++ project folder and rename the folder as
Program 1. (ii) Replace the contents of program in the sample Visual C++
project with what you have for lab #1 (a simple inch-to-cm conversion
program), and then repeatedly compile, test, and debug your program until
it works fine. (iii) Email the .cpp file
as an attachment to you class TA (for 11:30~12:20 Section: Philip Myers; for 12:30~1:20 Section: Godestablishedyou Escobedo.) for grading.
- Computer Science showcase# 2 (What makes a complex
full-fledged C++ application program?): In the library lab, download
and play with the following full-fledged C++ program using the QT toolkit in the
computer lab since we have installed the education version of the QT
graphical user interface environment in the computers there: download this zip file,
unzip it to get a QTexample folder, find
the demo subfolder within QTexample,
double click the solution file demo.sln
to open the entire demo project under Microsoft Visual C++, browse the
source code, and run the program to get a feeling of it.
Week 3: If statements,
logical operators, and relational operators Progress report due: Wednesday, Sept. 16
- Reading #3: Read sections
4.1~4.10 of the textbook on if
statements, logical operators, and relational operators.
- Programming
Assignment #1 (Using both
int and double variables and the integer modulus % operator for a temperature/
currency conversion program): Due Date: Wednesday,
Sept. 16.
Week 4: More on if
statements, logical operators, and relational operators Progress report
due: Wednesday, Sept. 23
Week 5: Basics of while
loops and
for loops Progress report due: Wednesday, Sept.30
- Computer Science
showcase #4 (Can the computer perceive your emotion and transcribe what
you say?)
Week 6: More on while
loops and
for loops Progress report due: Wednesday, Oct.7
Computer Science showcase
#6 (How well can the computer autonomously perceive the environment to move in
it and to interact with it?)
Week 7: Basics of
Functions Progress report due: Wednesday, Oct.14
- Reading #7:
- Browse (i) the diagrams and the
introduction section in this Wikipedia article
on public-key
cryptography encryption and the role of prime numbers in it, and (ii)
the introductory paragraph
of a Wikipedia article on RSA public-key
encryption and the subsection on RSA key generation
regarding the role of prime numbers, and (iii) this
article about very large prime numbers recently found.
- Read Sections
6.1~6.7 on the basics of how to define your own functions and call
these functions.
- Programming
Assignment #4B (Using nested loops for finding prime numbers): Due Date: Wednesday, Oct. 14
Computer Science showcase #7 (Using loops to
measure the speed of the computer; Prime numbers and Cryptography)
- Using loops to
measure the speed of the computer: Download and unzip this zipped file to
get an executable file (Speed.exe) and a C++ program project folder
(Speed). Double click Speed.exe to run the program to measure the
speed of the computer in doing number crunching. Open the Visual C++
project in Speed folder to see how random integers are generated by
calling the C++ library function rand( ) and how
loops are used in the C++ code for adding random integers.
- Prime numbers and Cryptography:
- Browse the encryption related stuff in Reading #7.
- Download this Windows zip file,
extract it to get a visual C++ programming project folder containing C++
code, C++ project files, and a text file myRSA.txt
containing a secret message from me.
- Open up RSA.sln in
the Visual C++ project to compile and run the C++ program under Windows.
Use x’=19307 and y’ = 11483 as the public key to decrypt the secret
message in myRSA.txt. Include in your progress report what the original
message is about.
- Use the program above to generate a public
key (a,b) and a
private key (c, d). Write them down. Inform another person in the class
of your public key (a,b).
Use the program to encrypt a message into a .txt file using your private
key (c,d) and email it
to your friend. Ask them to check whether he/she can correctly descript
the message back using the program and the public key (a,b).
- Ask your friend to encrypt a message into a .txt
file using your public key (a,b)
and email it to you. Check to see whether you can correctly descript
the message back using the purivate key (c,d).
Weeks 8~9: More on Functions; Torrey
Conference; Midterm Test
Programming
Assignment #5A (Use functions to implement a new ATM service program): Due Date: Wednesday, Oct. 21.
Reading #8 Read Sections
6.7~6.10, 6.13 on the use of return statements, local versus global
variables, and reference variables as parameters. Due:
Wednesday, Oct. 28
Computer Science showcase
#8 (Could the computer communicate with me and understand what I mean?).
- Read the
introduction and history sections in this Wikipedia
article on the Turing test.
Take an online Turing test here. Download and play with
the chatter-bot Claude.
- Play with this
online automatic Google
translation service and their FAQs to get a sense of the state of the art in
automatic translation. Browse the introductory sections of this Wikipedia article on automatic translation.
Midterm open-book written test: Wednesday, Oct. 28.
- Cover all things from the textbook included in Readings #1~ #8.
- You cannot use any compiler to compile programs during the test.
Week 10: Basics of
Arrays. Progress report due: Wednesday, Nov. 4
Reading #10: Read sections
7.1~7.5 of the textbook on the basics of arrays.
Programming
Assignment #5B (Use functions to implement a new ATM service program for
handling prime numbers): Due Date: Wednesday, Nov. 4.
Computer Science
showcase #10 (2D and 3D computer graphics):
- Briefly browse through the Wikipedia articles
about computer
graphics and computer
animation.
- Download, unzip, and play with this powerful demo of a 3D virtual world.
- Download this zip fileand extract it to
get a C++ project folder. Open the project, compile and run it to see the
graphics effects step by step (by pressing the keyboard to see the effect
of one 2D graphics function at a time). Then examine the main function in graphics_demo.cpp to see how it can call some
2D graphics functions (implemented in winbg2i.cpp) to generate 2D graphics.
- Download this zip file and
extract it to get a C++ project folder. Open the project, compile and run
it to see a bouncing box. Try to press g to toggle the effect of
gravity, press t to toggle the effect of the trace, press c to
toggle the effect of the random coloring of the box, press f to
make the box move faster, press s to make the box move slower. Then
carefully examine the main function in bouncing_box.cpp
to understand how the bouncing box works. Succinctly describe in your
progress report your understanding of how the main function makes the
bouncing box work.
- See some of the 2D graphics
games implemented by CSCI 105 students using 2D graphics functions you
see in the samples in the reading above.
Week 11: More on Arrays:
Searching and Sorting. Progress report due: Wednesday, Nov. 11
Reading #11: Read sections
7.7, 8.1~8.3 of the textbook on arrays as function arguments, and searching
/ sorting with arrays.
Computer Science showcase #11: How do the computer
store information in bits and bytes (include your findings in the progress
report)
1: By using powers of 2 instead of 10 to encode
integers, the computer uses a binary number system to encode an integer in bits
of 0’s and 1’s (instead of 10 different digits in the decimal system).
2: Character are encoded in 8 bits (i.e. 1 byte)
as numbers using the ASCII
character set encoding that maps a character into a number in the range of
0 to 255.
- Exercise: Suppose the 5 bytes (i.e. 5 groups of 8 bits each) of
information in Step 1 above (i.e 01000010,
01101001, 01101111, 01101100, and 01100001) are stored as a part of a text
file to encode the information of 5 characters (8 bits for each character)
using the ASCII
character set encoding. Explain in your report what the five characters
are.
3: Observation: the size of a pure text file
(.txt file) in bytes is close to the number of characters in the file since
each character in a plain text file is encoded in 1 byte of memory.
- Exercise: Use NotePad to create four text files of about 100
characters, 200 characters, 400 characters, and 800 characters
respectively and save them as text files. Record and report the sizes of
these files (in terms of bytes). Note that it takes one byte to record a
character. Explain in your report the relationship between the number of
characters and the file sizes you see.
4: Observation: the size of a picture in the
24-bit BMP file format in bytes is about 3 times the number of pixels since the
color of each pixel is encoded in terms of 24 bits, i.e. 3 bytes.
- Exercise: Press the
Print Screen key on the keyboard
to capture the screen as a picture. Open up Microsoft Paint, paste the
image into the canvass, and save it as a 24-bit bitmap file (i.e a .BMP file), which use 24 bits (3 bytes) for
storing the color information of each pixel in the picture. Check the file
size. Explain in your report the relationship between the screen
resolution, the BMP file format, and the file size you see.
Week 12: Basics of Structures; Review of File
Input/Output. Progress report due: Wednesday, Nov. 18
Reading #12: Read sections
3.14 and 4.17 on file Input/Output, and sections
11.1~11.8 on the basics of structures.
Programming
Assignment #6A (A simple score database using an array and file input/output ): Due Date: Wednesday, Nov.
18.
Week 13: Basics of
Recursion. Progress report due: Wednesday, Nov. 25
Reading #13: (i)
Read sections 19.1~19.4 on the basics of recursion (ii) Read up to the section on Recursive
Solution in this Wikipedia article on the Tower of Hanoi and (iii) play with this sample demo
executable (zipped) for the Tower of Hanoi
puzzle. Due:
Wednesday, Nov. 25
Faith-and-Learning reflection assignment: Do this assignment and
include your reflection comments in your progress report. Due: Wednesday, Nov. 25
Programming
Assignment #6B (An enhanced score database with scores and names stored as an array of
structures): Due Date: Wednesday, Nov. 25.
*************************************************************************************************
Things
to come
Midterm Programming Test
(Intelligent computer program for playing Nim games):
- Due date: Wednesday,
Dec. 2.
- Submission: Fill out this midterm
evaluation form and email it together with the source code file(s)
of your midterm programming test as attachments to the TA.
To the Top
of the Page .