0% found this document useful (0 votes)
53 views9 pages

CS100 - Computational Problem Solving Fall 2020

This document discusses the problem solving process in 3 steps: 1) identifying the problem, 2) discovering a solution method by writing an algorithm or flowchart, and 3) producing a computer program by translating the algorithm into a programming language. It provides an example of an algorithm to calculate the sum of 3 numbers and notes this could be written more efficiently. Key aspects of algorithms, flowcharts, and computer programs are defined.

Uploaded by

noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views9 pages

CS100 - Computational Problem Solving Fall 2020

This document discusses the problem solving process in 3 steps: 1) identifying the problem, 2) discovering a solution method by writing an algorithm or flowchart, and 3) producing a computer program by translating the algorithm into a programming language. It provides an example of an algorithm to calculate the sum of 3 numbers and notes this could be written more efficiently. Key aspects of algorithms, flowcharts, and computer programs are defined.

Uploaded by

noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Lab 1

CS100 - Computational Problem Solving


Fall 2020
Problem Solving Process
Steps:
1. Problem Identification
2. Discovering a method of the solution
 writing an algorithm
 flow chart
3. Producing a computer program
 translating the algorithm into a programming language (C, C++, python, Java
etc)
2. Discovering a method of the solution
• Writing algorithm - a sequence of precise instructions which
leads to a solution.

Problem Solution

Can you think about


Efficient approach writing an algorithm to
make a cup of tea?
2. Discovering a method of the solution
• Flow Chart - a pictorial representation of an algorithm, workflow or process

• Gives better understanding through visualization

Flow line

Decision
Terminal
(start/end)

Process Input/Output

Components of a flow chart


3. Producing a computer program

• A computer program is a list of instructions that tells a computer


what to do.
• Everything a computer does is the result of an instruction.
• A computer program is written in a programming language.
3. Producing a computer program

#include <iostream>
using namespace std;

int main()
{
cout << “Hello world”;
return 0;
}
3. Producing a computer program
• Translation of a program into binary is important
• A computer understands only the language of 1s and 0s
Example: Computing sum of 3 numbers
1. Acquire 1st number
2. Store the number in variable x
3. Acquire 2nd number
4. Store the number in variable y
5. Add x and y
6. Store the result in variable sum1
7. Acquire 3rd number
8. Store the number in variable z
9. Add sum1 and z This is not an efficient
algorithm, though.
10. Store the result of addition in variable sum2 Can you write a better
11. Show the sum2 as result one?

You might also like