Problem-Solving Procedures
Problem Solving - analyzing the description of a problem until we reach a solution.
The need for a systematic way of solving problems
Break larger problems into smaller parts that can easier to handle. We split a problem into several smaller and simpler parts which are called sub-programs - Divide and Conquer.
21.2 Problem Solving Procedures
21.3 Real life applications and practical consideration
21.4 Different ways to solve the same problem
Top Down approach starts at system level or the abstract level. The task is divided into several manageable modules. (Stepwise refinement)
Bottom up approach starts at the component level or the concrete level. They are group together to form a system
Exercise 1 Go to http://codepad.org and try to run the following Program.(Select C++)
#include<iostream>
using namespace std;int main(){ cout<<"hello world!"<<endl; return 0;}
Exercise 2
// add up 1 to 100
#include<iostream>using namespace std;int main(){ sum = 0; i=1; while (i>100){ sum = sum + i; } cout<<sum<<endl; return 0;}