TCB2073 - Lecture 1 Introduction To Problem Solving
TCB2073 - Lecture 1 Introduction To Problem Solving
Introduction
Adapted from C++ for Everyone and Big C++ by Cay Horstmann
Objectives
What is Programming?
What is Programming?
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World!" <<
endl;
return 0;
}
C++
defines a function.
Every C++ program must have one and only one main function.
Most C++ programs contain other functions besides main (more about
functions later).
#include<iostream>
The linker combines machine code with library code into an executable program.
The Edit-Compile-Run
Loop
This process reflects the way
programmers work
(shown as a flowchart)
Algorithms
The Software
Development Process
For each problem
the programmer goes
through these steps
An informal description
Not in a language that a computer can understand, but easily
translated into a high-level language (like C++).
The method described in pseudocode must be
Unambiguous
Executable
Terminating
Step 3: Report the last value of the year in the repetition process.
That value is the number of years required to double the investment
After Year
Balance (RM)
10,000
End
Flowchart - Example
Sub-process (Add Value)
Summary
1.
2.
3.
4.
5.
6.
Summary
9.
10.
11.
Lecture Exercise 2
Expression and Equation
Volume = a x b x h
Lecture Exercise 2
As an EE engineer, you are required to develop a program,
which will check for the size of motherboard depending
on the size (in cm) and numbers of CPUs to be put on the board.
Given formula:
motherboard size/5 = CPU Size * Numbers of CPU
References