SI204

Class 1: General Architecture & Problem Solving

Reading

Section 1.1of Absolute C++

 

Lecture

I'm just listing the basic topics here rather than giving complete lecture notes. Complete notes will start with the next lecture.

 

1.      Parts of a computer: CPU, main memory, persistent storage (hard drive), input (keyboard), output (monitor)

2.      Filesystems: Tree structure, programs as files, etc. [It will probably save you many headaches if you go to "Start" -> "Settings" -> "Control Panel" -> "Folder Options" and make sure that under the "View" tab you have "Hide file extensions for known file types" off (i.e. unchecked). When this is on, you won't always see the full name of a file, which can be confusing!]

3.      Creating files: quick notepad, side note [It's hard not to create files! Try going to amazon.com, and then check your cookies! It created a file!]

4.      Your ultimate goal as a C++ programmer is to create a file - a file that is a program!

5.      Internet (Extending your filesystem): Tree structure in the underlying filesystems (go to CS Dept Webpage (http://www.usna.edu/CS/) and work to, for example, the Class 1 page for this course, to demonstrate), but of course we jump around almost randomly using hypertext links. The "web" is sort of like other people letting you look at their filesystems!

6.      More internet: with ftp you can read and write to other people's filesystems! What you can't do is run programs on their machine. You'll be using ftp on occasion in this class. (Everyone should have WS_FTP on their machines in Bancroft.)

7.      You have two accounts associated with being a computer science or IT major. You have a Windows account and a Unix account, and you'll keep these accounts while you're here, using different accounts for different classes and tasks.

8.      The department has several online resources for CS majors. Important to you will be

o        Department General Resources Page

o        Department Unix Resources

o        Department PC Support

9.      General steps to solving a problem.  In class we will talk a lot about how to take a general description of a problem and break it down into smaller pieces, until each piece is easy enough to actually do. At a high level, many problems we will work with can be thought of as taking 3 steps:

      1. Read some input
      2. Compute the result
      3. Output the result

10.  Let’s apply this pattern to solve the following problem: Design a program that will print the displacement of an object, in a meaningful manner, when the user provides the acceleration, the time, and the velocity.  The necessary formula is: disp = (velocity * time) + (0.5 * accel * time2).  You may test your code by inputting an acceleration of 0.18 m/s^2, a velocity of 2.50 m/s, and a time of 2.37 s.  The answer should be a displacement of 6.430521 m.  Note that in order to test a solution, you must know, typically by computing by hand, the actual answer for disp that we are expecting (here, 6.430521) before we run the program so we know whether the program works correctly for the input data used. First, let’s design a solution

11.  In class we'll bring up the Visual C++ 2005 Express Edition environment and show you what the basic process of creating a program will look like, specifically one to do the solve the displacement problem above.

12.  As time permits, we’ll add some additional options to our program:

      1. Check that the time entered is a positive number (print an error otherwise).
      2. Print out our name before doing anything else
      3. Breaking various things to see what kind of error messages result.
      4. The difference between “Start Debugging” and “Start Without Debugging”
      5. How to add comments

Assoc Prof Christopher Brown

Last modified by Asst Prof Luke McDowell 08/15/2007 09:06 AM