4/23/2015engineering problem solving with c++ second edition, j. ingber 1 engineering problem...
TRANSCRIPT
![Page 1: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/1.jpg)
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
1
Engineering Problem Solving with C++, Etter/Ingber
Chapter 1
![Page 2: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/2.jpg)
Introduction to Computing and Engineering Problem Solving
Historical Perspective Recent Engineering Achievements Computing Systems Data Representation and Storage An Engineering Problem Solving Methodology
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
2
![Page 3: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/3.jpg)
HISTORICAL PERSPECTIVE
Charles Babbage
Analytical Engine
Augusta Ada Byron
Digital Computers
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
3
![Page 4: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/4.jpg)
Charles Babbage, Esq. 1792-1871
English mathematician. Designed the Analytical Engine in the early
1800s. Published “Of the Analytical Engine” in
1864.04/18/23 Engineering Problem Solving with
C++ second edition, J. ingber4
![Page 5: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/5.jpg)
Analytical Engine
Designed to process base ten numbers. Consisted of four parts:
– Storage unit– Processing unit– Input device– Output device
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
5
![Page 6: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/6.jpg)
Analytical Engine
Luigi F. Menabrea, French engineer and mathematician, described Babbage’s vision of a machine capable of solving any problem using: – Inputs– Outputs– Programs written on punch cards
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
6
![Page 7: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/7.jpg)
Augusta Ada Byron, 1815-1852
Wrote the English translation of Menabrea’s Sketch of the Analytical Engine.
Envisioned the multidisciplinary potential of the Analytical Engine.
Wrote detailed instructions for performing numerical computations using the Analytical Engine.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
7
![Page 8: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/8.jpg)
Digital Computers ABC (Atanasoff Berry Computer)
• Developed at Iowa State University between 1939 and 1942 by John Atanasoff and Clifford Berry.
• Weighed 700 pounds.
• Executed one instruction every 15 seconds.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
8
![Page 9: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/9.jpg)
Digital Computers ENIAC(Electronic Numerical Integrator
And Calculator)• Developed by research team lead by John Mauchly
and J. Presper Eckert during the early 1940s.
• Weighed 30 tons.
• Executed hundreds of instructions every second.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
9
![Page 10: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/10.jpg)
Digital Computers
Intel Pentium 4 Processor.• Weighs < 16 ounces.
• Executes trillions of instructions per second.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
10
![Page 11: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/11.jpg)
RECENT ENGINEERING ACHIEVEMENTS
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
11
![Page 12: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/12.jpg)
Recent Engineering Achievements
Digital computers facilitate multidisciplinary engineering achievements that:– Improve our lives
– Expanded the possibilities for our future.
Changing engineering environment requires engineers with:– Communication skills
– Skills for working in interdisciplinary teams
– An awareness of ethic issues and environmental concerns.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
12
![Page 13: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/13.jpg)
COMPUTING SYSTEMS
Computer Hardware
Computer Software
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
13
![Page 14: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/14.jpg)
Computing Systems
A computing system is a complete working system that includes:– Hardware– Software
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
14
![Page 15: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/15.jpg)
Hardware
Hardware refers to the physical parts off the computing system that have mass (ie they can actually be touched):– Computer– Display– Mouse– Printer– …
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
15
![Page 16: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/16.jpg)
Computer Hardware
Jon von Neumann computing model– Input device– Output device– Memory Unit– CPU(Central Processing Unit) consisting of:
• Control Unit
• ALU(Arithmetic Logic Unit)
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
16
![Page 17: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/17.jpg)
Von Neumann computing model
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
17
![Page 18: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/18.jpg)
Software Computer software refers to programs that
reside and execute electronically on the hardware.– Compilers
– Translate source code
– Operating systems– Provide the HCI (Human Computer Interface)
– Application programs– Provide problem solutions
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
18
![Page 19: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/19.jpg)
Hierarchy of Computer Languages
Natural Language Processing Cobol Pascal Java C++ Assembler Machine Language04/18/23 Engineering Problem Solving with
C++ second edition, J. ingber19
![Page 20: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/20.jpg)
Executing a C++
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
20
![Page 21: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/21.jpg)
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
21
Key Terms Source Program
– printable/Readable Program file Object Program
– nonprintable machine readable file Executable Program
– nonprintable executable code Syntax errors
– reported by the compiler Linker errors
– reported by the linker Execution/Run-time errors
– reported by the operating system Logic errors
– not reported
![Page 22: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/22.jpg)
DATA REPRESENTATION AND STORAGE
Number Systems
Data Types and Storage
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
22
![Page 23: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/23.jpg)
Data Representation and Storage
Digital computers store information as a sequence of bits (binary digits).
The value or state of a bit at any given time can be 0 or 1 (off or on).
Data is stored as a sequence of bytes. – A byte is a sequence of 8 bits.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
23
![Page 24: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/24.jpg)
Data Representation and Storage:Memory DiagramAddress Sixteen Bit Word
000 0000101011011101
001 1010001011010100
010 1011010010100101
011 0101001101010101
010 0101000111001110
010 1100110000111010
110 0100011101001001
111 0101110001001000
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
24
Address Space = 8Word Size = 16
![Page 25: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/25.jpg)
Data Representation and Storage
Right most bit is referred to as the least significant bit.
Left most bit is referred to as the most significant bit.
Value stored at address 000 is 00001010110111012 = 278110 But what does it
represent?
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
25
![Page 26: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/26.jpg)
Number Systems
Base ten number system• Ten decimal digits (0,1,2,3,4,5,6,7,8,9)
• Each digit multiplies a power of ten
– Example:
24510 = 2*102 + 4*101 + 5*100
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
26
![Page 27: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/27.jpg)
Number Systems
Base two (binary) number system• Two binary digits (0,1)
• Each digit multiplies a power of two
– Example:
101102 = 1*24 + 0*23 + 1*22 + 1*21 + 0*20
= 1*16 + 0*8 + 1*4 + 1*2 + 0*1
= 16 + 0 + 4 + 2 + 0
= 2210
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
27
![Page 28: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/28.jpg)
Number Systems
Base eight number system• Eight octal digits (0,1,2,3,4,5,6,7)
• Each digit multiplies a power of eight
– Example:
2458 = 2*82 + 4*81 + 5*80
= 2*64 + 4*8 + 5*1
= 128 + 32 + 5
= 1658
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
28
![Page 29: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/29.jpg)
Number Systems
Base sixteen number system• Sixteen hex digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
• Each digit multiplies a power of sixteen
– Example:
2FB16 = 2*162 + F*161 + B*160
= 2*256 + F*16 + B*1
= 512 + 240 + 11
= 76310
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
29
![Page 30: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/30.jpg)
Number Systems: Practice!
1002 = ?8
37168 = ?2
1101001112 = ?10
3A1B16 = ?2
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
30
![Page 31: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/31.jpg)
Data Types
Integer Data Type:– Often represented in 4 bytes (System
Dependent)– Left most bit is reserved for the sign of the
number– Remaining 31 bits represent the magnitude of
the number.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
31
![Page 32: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/32.jpg)
Data Types
Representation of data affects the efficiency of arithmetic and logic operations.
For efficiency, negative integers are often represented in their 2’s complement form.
The 2’s complement of an integer is formed by negating all of the bits and adding one.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
32
![Page 33: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/33.jpg)
Example: 2’s Complement
Form the 2’s complement representation for the value -12710 assuming a word size of 8 for simplicity.12710 = 011111112
Negate bits: 10000000
Add 1: 10000001
2’s complement is 10000001
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
33
![Page 34: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/34.jpg)
Example: 2’s Complement
Add 127 to -12701111111
+10000001
= _______00000000
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
34
![Page 35: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/35.jpg)
Data Types
Floating Point Data– Floating point types represent real numbers,
such as 1.25, that include a decimal point.– Digits to the right of the decimal point form the
fractional part of the number.– Digits to the left of the decimal point form the
integral part of the number.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
35
![Page 36: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/36.jpg)
Practice! Floating Point Data
Convert 12.2510 to binary.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
36
![Page 37: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/37.jpg)
AN ENGINEERING PROBLEM-SOLVING METHODOLOGY
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
37
![Page 38: 4/23/2015Engineering Problem Solving with C++ second edition, J. ingber 1 Engineering Problem Solving with C++, Etter/Ingber Chapter 1](https://reader034.vdocument.in/reader034/viewer/2022051315/56649c895503460f94942061/html5/thumbnails/38.jpg)
5 Step Problem Solving Methodology1. State the problem clearly.
2. Describe the input and output.
3. Work a hand example.
4. Develop a solution.
5. Test your solution.
04/18/23 Engineering Problem Solving with C++ second edition, J. ingber
38