You are on page 1of 3

# Lecture1

1 of 3

http://www.charlesli.org/pic10a/lectures/lecture1/index.html

PIC10A Lecture 1

Section 1.1

Computer and Computer programs
OR "Hardware of Software
Hardware consists of the physical components of the system.
Software consists of programs that control the hardware to solve a problem,

Elements of Hardware
Central Processing Unit(CPU)
Memory (including RAM)
Input/Output Device(keyboard, mouse, monitor, printer, etc etc)

Software
Programs are written using an unambigous computer langauge
Low level: assembly language, machine
High level: C++, java
PIC10A will mainly deal with software written in C++

Software Development
Problem specification(information and goals)
Design(data structure, algorithms)
Implementation(coding)
Testing/debugging
Maintenance

Example:
Question: Calculate the increase percentage of the tuition fee.

Problem specification
What do you know? (this year's tuition fee, last year's tuition fee)
What do you want? (the increase percentage)

Design and Implementation
Data Structures
Algorithms(unambiguous directions that use the data structure to solve the problem)
10/12/2015 3:56 PM

charlesli. cin >> lastYearFee. } return 0.lastYearFee)/lastYearFee. you will be told about this in no uncertain terms. but didn't define(e.org/pic10a/lectures/lecture1/index. Maintenance. Input this year's tuition fee 2. cout << "Please enter last year's tuition fee: ". int main() { double thisYearFee. lastYearFee. Here is the output of the program Please enter last year's tuition fee: 1233 Please enter this year's tuition fee: 1459 The tuition increases 18. If you make any typographical errors or use any errant punctuation. cin >> thisYearFee.g.\n". Input last year's tuition fee 3. output the result Here is the code #include<iostream> using namespace std.Lecture1 2 of 3 http://www. Syntax errors: these are where the compiler expects a particular set of symbols and you provide something 10/12/2015 3:56 PM .this year's tuition fee)/(last year's tuition fee) times 100% 4. Building(Compiling and linking) Compiling translate high-level code to a langauge the computer understands Likings adds in the tools used. and Documentation On first attemps roughly 99.html Consists of translating pseudocode into a computer language Pseudocode for the example 1. cout << "Please enter this year's tuition fee: ".3293%. cout) Testing/Debugging. calculate the increase precentage by the formula increasePercentage = (last year's tuition fee . percentage. cout << "The tuition increases " << percentage*100 << "%.9999999% of all codes have mistakes Can be syntax and logical Maintenance keeps things up-to-date Documentation ensures others can use your program Compiler and Syntax Error You can think of the compiler as a very strict English teacher. percentage = (thisYearFee .

The value will be stored in a variable named x. lastYearFee. in the above program. int main() { /_____________ these two lines are included \ so that the libaries about input/output are available to the program <----------------. (The image is for Visual C++) Explanation of the program #include<iostream> using namespace std. You type doule thisYearFee.charlesli. cin >> lastYearFee.Lecture1 3 of 3 http://www.org/pic10a/lectures/lecture1/index. 10/12/2015 3:56 PM .fill your codes here } return 0. cout <<"blah blah blah". declare 3 decimal numbers cin >> x. percentage. percentage. lastYearFee. outputs blah blah blah on the screen double thisYearFee. lastYearFee. asks the user to input a value. For example. Code Explanation cout << "Please enter last year's tuition fee: ". instead of double thisYearFee. percentage.html that is not expected.