Professional Documents
Culture Documents
1 of 3
http://www.charlesli.org/pic10a/lectures/lecture1/index.html
PIC10A Lecture 1
Reading
Section 1.1
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)
Building(compiling and linking)
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)
Lecture1
2 of 3
http://www.charlesli.org/pic10a/lectures/lecture1/index.html
#include<iostream>
using namespace std;
int main() {
double thisYearFee, lastYearFee, percentage;
cout << "Please enter last year's tuition fee: ";
cin >> lastYearFee;
cout << "Please enter this year's tuition fee: ";
cin >> thisYearFee;
percentage = (thisYearFee - lastYearFee)/lastYearFee;
cout << "The tuition increases " << percentage*100 << "%.\n";
}
return 0;
Lecture1
3 of 3
http://www.charlesli.org/pic10a/lectures/lecture1/index.html
You type
return 0;
Code
Explanation
10/12/2015 3:56 PM