410 likes | 592 Views
Engineering Problem Solving with C++, Etter/Ingber. Chapter 1. Introduction to Computing and Engineering Problem Solving. Historical Perspective Recent Engineering Achievements Computing Systems Data Representation and Storage An Engineering Problem Solving Methodology. Charles Babbage
E N D
Engineering Problem Solving with C++, Etter/Ingber Chapter 1 Engineering Problem Solving with C++ second edition, J. ingber
Introduction to Computing and Engineering Problem Solving • Historical Perspective • Recent Engineering Achievements • Computing Systems • Data Representation and Storage • An Engineering Problem Solving Methodology Engineering Problem Solving with C++ second edition, J. ingber
Charles Babbage Analytical Engine Augusta Ada Byron Digital Computers Historical Perspective Engineering Problem Solving with C++ second edition, J. ingber
Charles Babbage, Esq. 1792-1871 • English mathematician. • Designed the Analytical Engine in the early 1800s. • Published “Of the Analytical Engine” in 1864. Engineering Problem Solving with C++ second edition, J. ingber
Analytical Engine • Designed to process base ten numbers. • Consisted of four parts: • Storage unit • Processing unit • Input device • Output device Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
Digital Computers • Intel Pentium 4 Processor. • Weighs < 16 ounces. • Executes trillions of instructions per second. Engineering Problem Solving with C++ second edition, J. ingber
Recent Engineering Achievements Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
Computer Hardware Computer Software Computing Systems Engineering Problem Solving with C++ second edition, J. ingber
Computing Systems • A computing system is a complete working system that includes: • Hardware • Software Engineering Problem Solving with C++ second edition, J. ingber
Hardware • Hardware refers to the physical parts off the computing system that have mass (ie they can actually be touched): • Computer • Display • Mouse • Printer • … Engineering Problem Solving with C++ second edition, J. ingber
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) Engineering Problem Solving with C++ second edition, J. ingber
Von Neumann computing model Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
Hierarchy of Computer Languages • Natural Language Processing • Cobol • Pascal • Java • C++ • Assembler • Machine Language Engineering Problem Solving with C++ second edition, J. ingber
Executing a C++ Engineering Problem Solving with C++ second edition, J. ingber
Key Terms • Source Program • printable/Readable Program file • Object Program • nonprintable machine readable file • ExecutableProgram • 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 Engineering Problem Solving with C++ second edition, J. ingber
Number Systems Data Types and Storage Data representation and storage Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
Data Representation and Storage:Memory Diagram Address Space = 8 Word Size = 16 Engineering Problem Solving with C++ second edition, J. ingber
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? Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
Number Systems: Practice! • 1002 = ?8 • 37168 = ?2 • 1101001112 = ?10 • 3A1B16 = ?2 Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
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 Engineering Problem Solving with C++ second edition, J. ingber
Example: 2’s Complement • Add 127 to -127 01111111 + 10000001 = _______ 00000000 Engineering Problem Solving with C++ second edition, J. ingber
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. Engineering Problem Solving with C++ second edition, J. ingber
Practice! Floating Point Data • Convert 12.2510 to binary. Engineering Problem Solving with C++ second edition, J. ingber
An engineering problem-solving methodology Engineering Problem Solving with C++ second edition, J. ingber
5 Step Problem Solving Methodology • State the problem clearly. • Describe the input and output. • Work a hand example. • Develop a solution. • Test your solution. Engineering Problem Solving with C++ second edition, J. ingber