0% found this document useful (0 votes)
129 views11 pages

Chapter 1

This document provides an overview of an engineering problem solving course that uses C++. It introduces the course objectives, which are to understand basic computing terminology, a problem solving methodology, and programming concepts like control structures, arrays, classes and pointers. It also lists the textbook, instructors, their contact information, and the grading breakdown. Finally, it provides some historical context on the development of computing from the Analytical Engine to modern digital computers.

Uploaded by

Do Kim
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views11 pages

Chapter 1

This document provides an overview of an engineering problem solving course that uses C++. It introduces the course objectives, which are to understand basic computing terminology, a problem solving methodology, and programming concepts like control structures, arrays, classes and pointers. It also lists the textbook, instructors, their contact information, and the grading breakdown. Finally, it provides some historical context on the development of computing from the Analytical Engine to modern digital computers.

Uploaded by

Do Kim
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Engineering Problem Solving Objectives

with C++, Etter/Ingber


 Understanding of basic terminology for
Chapter 1: Introduction
computers.
Prof. Xin Wang ([email protected])
Office: 235 Light Engineering building
Class time: TuTh 3:50 pm – 5:10 pm
 Understanding of a problem-solving
Office Hour: Tu: 10:00 pm- 12:00 pm
methodology used when solving
TAs: Ying Li ([email protected])
Zhiyuan Wong ([email protected])
engineering problems with a computer
Takfung Yip ([email protected])

Office hours:
Mon: 11:30 am -1:30 pm, Wed; 10:00 am-12:00 pm; Fri: 10:am – 12:00 pm
Office Place: Light Engineering Building Room 208

9/1/2010 Engineering Problem Solving with 1


C++ second edition, J. ingber

Books Course Overview


 Dolores M. Etter and Jeanine A. Ingber, Engineering
Simple C++ Programs
 Problem Solving with C++ 2/E, Prentice Hall, 2008, Control Structures
 ISBN: 0136011756 Programming with Data Files
Modular Programming with Functions

 References: One-Dimensional Arrays
 Deitel, Deitel, Nieto & Strassberger, GETTING Two-Dimensional Arrays and Matrices
 STARTED with Microsoft Visual C++ 6 with an
Introduction to Classes
 Introduction to MFC, Prentice Hall, 2000
 ISBN: 0130132497 Pointers and Creating Data Structures
 Thinking in C++, download at Programming with Classes
 http://www.planetpdf.com/developer/article.asp?ContentID=6634
 Lecture notes
Introduction to Computing and
Grading Engineering Problem Solving
 Homework: 25%  Historical Perspective
 Mid-term: 20%  Recent Engineering Achievements
 Computing Systems
 Project: 20%
 Data Representation and Storage
 Final: 30%
 An Engineering Problem Solving Methodology
 Class participation and and quiz 5%

9/1/2010 Engineering Problem Solving with 6


C++ second edition, J. ingber

Charles Babbage, Esq. 1792-1871

 English mathematician.
 Designed the Analytical Engine in the early
Charles Babbage
1800s.
Analytical Engine
Augusta Ada Byron  Published “Of the Analytical Engine” in
Digital Computers 1864.
HISTORICAL PERSPECTIVE

9/1/2010 Engineering Problem Solving with 7 9/1/2010 Engineering Problem Solving with 8
C++ second edition, J. ingber C++ second edition, J. ingber
Analytical Engine Analytical Engine
 Luigi F. Menabrea, French engineer and
 Designed to process base ten numbers. mathematician, described Babbage’s vision
 Consisted of four parts: of a machine capable of solving any
– Storage unit problem using:
– Processing unit – Inputs
– Input device – Outputs
– Output device – Programs written on punch cards

9/1/2010 Engineering Problem Solving with 9 9/1/2010 Engineering Problem Solving with 10
C++ second edition, J. ingber C++ second edition, J. ingber

Augusta Ada Byron, 1815-1852 Digital Computers


 Wrote the English translation of Menabrea’s  ABC (Atanasoff Berry Computer)
Sketch of the Analytical Engine. • Developed at Iowa State University between 1939
and 1942 by John Atanasoff and Clifford Berry.
 Envisioned the multidisciplinary potential
• Weighed 700 pounds.
of the Analytical Engine. • Executed one instruction every 15 seconds.
 Wrote detailed instructions for performing
numerical computations using the
Analytical Engine.

9/1/2010 Engineering Problem Solving with 11 9/1/2010 Engineering Problem Solving with 12
C++ second edition, J. ingber C++ second edition, J. ingber
Digital Computers Digital Computers
 ENIAC(Electronic Numerical Integrator  Intel Pentium 4 Processor.
And Calculator) • Weighs < 16 ounces.
• Developed by research team lead by John Mauchly • Executes trillions of instructions per second.
and J. Presper Eckert during the early 1940s.
• Weighed 30 tons.
• Executed hundreds of instructions every second.

9/1/2010 Engineering Problem Solving with 13 9/1/2010 Engineering Problem Solving with 14
C++ second edition, J. ingber C++ second edition, J. ingber

Recent Engineering Achievements


 Digital computers  Changing engineering
facilitate multidisciplinary environment requires
engineering achievements engineers with:
that: – Communication skills
– Improve our lives – Skills for working in
– Expanded the possibilities interdisciplinary teams
for our future. – An awareness of ethic issues
and environmental concerns.
RECENT ENGINEERING
ACHIEVEMENTS
9/1/2010 Engineering Problem Solving with 15 9/1/2010 Engineering Problem Solving with 16
C++ second edition, J. ingber C++ second edition, J. ingber
Computing Systems
 A computing system is a complete working
system that includes:
– Hardware
Computer Hardware
– Software
Computer Software

COMPUTING SYSTEMS

9/1/2010 Engineering Problem Solving with 17 9/1/2010 Engineering Problem Solving with 18
C++ second edition, J. ingber C++ second edition, J. ingber

Hardware Computer Hardware


 Hardware refers to the physical parts off the  Jon von Neumann computing model
computing system that have mass (ie they – Input device
can actually be touched): – Output device
– Computer – Memory Unit
– Display – CPU(Central Processing Unit) consisting of:
– Mouse • Control Unit
– Keyboard • ALU(Arithmetic Logic Unit)
– Printer

9/1/2010 … Engineering Problem Solving with 19 9/1/2010 Engineering Problem Solving with 20
C++ second edition, J. ingber C++ second edition, J. ingber
Von Neumann computing
model 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

9/1/2010 Engineering Problem Solving with 21 9/1/2010 Engineering Problem Solving with 22
C++ second edition, J. ingber C++ second edition, J. ingber

Executing a C++ 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
 Compiler  Execution/Run-time errors
– Converts source program to object program (translates – reported by the operating system
high level language to machine language)  Logic errors
– not reported
 Linker
– Converts objectEngineering
9/1/2010 program toSolving
Problem executable
with program 23 9/1/2010 Engineering Problem Solving with 24
C++ second edition, J. ingber 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
Number Systems can be 0 or 1 (off or on).
Data Types and Storage  Data is stored as a sequence of bytes.
DATA REPRESENTATION AND – A byte is a sequence of 8 bits.
STORAGE
9/1/2010 Engineering Problem Solving with 25 9/1/2010 Engineering Problem Solving with 26
C++ second edition, J. ingber C++ second edition, J. ingber

Data Representation and Storage:


Memory Diagram
Data Representation and Storage
Address Sixteen Bit Word Example:  Right most bit is referred to as the least
000 0000101011011101 Address Space = 8
001 1010001011010100 Word Size = 16 significant bit.
010 1011010010100101
 Left most bit is referred to as the most
011 0101001101010101
010 0101000111001110
significant bit.
010 1100110000111010  Value stored at address 000 is
110 0100011101001001
111 0101110001001000
00001010110111012 = 278110 But what does it
represent?

9/1/2010 Engineering Problem Solving with 27 9/1/2010 Engineering Problem Solving with 28
C++ second edition, J. ingber C++ second edition, J. ingber
Number Systems Number Systems
 Base ten number system  Base two (binary) number system
• Ten decimal digits (0,1,2,3,4,5,6,7,8,9) • Two binary digits (0,1)
• Each digit multiplies a power of ten • Each digit multiplies a power of two
– Example: – Example:
24510 = 2*102 + 4*101 + 5*100 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
9/1/2010 Engineering Problem Solving with 29 9/1/2010 Engineering Problem Solving with 30
C++ second edition, J. ingber C++ second edition, J. ingber

Number Systems Number Systems


 Base eight number system  Base sixteen number system
• Eight octal digits (0,1,2,3,4,5,6,7) • 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 eight • Each digit multiplies a power of sixteen
– Example: – Example:
2458 = 2*82 + 4*81 + 5*80 2FB16 = 2*162 + F*161 + B*160
= 2*64 + 4*8 + 5*1 = 2*256 + F*16 + B*1
= 128 + 32 + 5 = 512 + 240 + 11
= 16510 = 76310
9/1/2010 Engineering Problem Solving with 31 9/1/2010 Engineering Problem Solving with 32
C++ second edition, J. ingber C++ second edition, J. ingber
Number Systems: Practice! Number Systems: Practice!
 1002 = ?8  1002 = 48
 37168 = ?2  37168 = 011 111 001 1102
 1101001112
 1101001112 = ?10
=1*28+1*27+0*26+1*25+0*24+0*23+1*22+1*21+1
 3A1B16 = ?2 *2010
 =256+128++32+4+2+1
 =42310
 3A1B16 = 0011 1010 0001 10112

9/1/2010 Engineering Problem Solving with 33 9/1/2010 Engineering Problem Solving with 34
C++ second edition, J. ingber C++ second edition, J. ingber

Data Types Data Types


 Integer Data Type:  Representation of data affects the efficiency
– Often represented in 4 bytes (System of arithmetic and logic operations.
Dependent)  For efficiency, negative integers are often
– Left most bit is reserved for the sign of the represented in their 2’s complement form.
number
 The 2’s complement of an integer is formed
– Remaining 31 bits represent the magnitude of
the number.
by negating all of the bits and adding one.

9/1/2010 Engineering Problem Solving with 35 9/1/2010 Engineering Problem Solving with 36
C++ second edition, J. ingber C++ second edition, J. ingber
Example: 2’s Complement Example: 2’s Complement
 Form the 2’s complement representation for  Add 127 to -127
the value -12710 assuming a word size of 8 01111111
for simplicity. +
12710 = 011111112 10000001
Negate bits: 10000000 = _______
Add 1: 10000001 00000000
 2’s complement is 10000001

9/1/2010 Engineering Problem Solving with 37 9/1/2010 Engineering Problem Solving with 38
C++ second edition, J. ingber C++ second edition, J. ingber

Data Types Practice! Floating Point Data


 Floating Point Data ™ Convert 12.2510 to binary.
– Floating point types represent real numbers, ™ Integer part:
such as 1.25, that include a decimal point. 12/2 R 0 (LSB) remainder is 0
– Digits to the right of the decimal point form the 6/2 R 0
fractional part of the number. 3/2 R 1
1/2 R 1 (MSB)
– Digits to the left of the decimal point form the
Fraction part:
integral part of the number.
0.25 x 2 C0 Carry is 0
0.5 x2 C1
9/1/2010 Engineering Problem Solving with 39 12.2510=1100.012Engineering Problem Solving with
9/1/2010 40
C++ second edition, J. ingber C++ second edition, J. ingber
5 Step Problem Solving
Methodology
1. State the problem clearly.
2. Describe the input and output.
3. Work a hand example.
4. Develop a solution.
5. Test your solution.
AN ENGINEERING PROBLEM-
SOLVING METHODOLOGY
9/1/2010 Engineering Problem Solving with 41 9/1/2010 Engineering Problem Solving with 42
C++ second edition, J. ingber C++ second edition, J. ingber

Example
First Program – volume of a box
1. Write a program to compute the volume of box.
2. Input: length, width, height /************************************************************/
/* Program chapter1 */
Output: volume /* */
/* This program computes the volume of a box */
3. Hand Example: /************************************************************/
#include <iostream>
volume = 20.75*11.5*9.5 using namespace std;
9.5 int main()
{
11.5 // Declare and initialize objects
20.75
double length( 20.75), width(11.5),height(9.5), volume;
// Calculate volume.
volume = length * width * height;
4. Solution: input length, width and height // Print the volume.
compute volume cout << “The volume is “ << volume << endl;
output volume // Exit program.
return 0;
5. Implement algorithm in C++ and test. }
/************************************************************/

You might also like