... chains 30 /4 Attribute listing 31 /5 32 /6 Back to the customer 33 /7 Back to the sun Circle of opportunity 34 /8 35 /9 Computer programs 30 TABLE 2.1 Creativity Techniques by ProblemSolving Stage 36 /10 ... Creativity is vital to successful problemsolving The problem- solving proFigure 2.1 The Creative Problem- Solving (CPS) Process Environmental Analysis Problem Recognition Problem Identification Making ... technique's position within that section of the problemsolving model TABLE 2.1 Creativity Techniques by ProblemSolving Stage ENVIRONMENTAL ANALYSIS (Discussed in Chapter 3) 1/1 2/2 3/ 3 4/4 Comparisons...
... Preface C++ 3e.fm Page iii Monday, July 16, 2001 1:44 PM PREFACE Welcome to the third edition of Data Abstraction and ProblemSolvingwith C++: Walls and Mirrors Since the ... easier for us to teach—and to learn—computer science With its focus on data abstraction and other problem- solving tools, this book is designed for a second course in computer science In recognition ... repetitive technique that solves a problem by solving smaller problems of exactly the same type, much as mirror images grow smaller with each reflection This book was written with you in mind As former...
... Structures Computer Components Computing Profession Ethics Problem- Solving Techniques What is Computer Programming? ● It is the process of planning a sequence of steps(called instructions) for a computer ... Phases • Problem- Solving • Implementation • Maintenance Problem- Solving Phase ● Analyze the problem and specify what the solution must ● Develop a general solution(algorithm) to solve the problem ... 70’s : OOP becomes popular ● Bjarne Stroustrup at Bell Labs adds features to C to form “C with Classes” ● 19 83 : Name C++ first used ● 1998 : ISO/ANSI standardization of C++ Computer Components...
... for expression and variable See examples on Slides 31 , 32 , and 33 What value is stored? float a; float b; a = 8.5; b = 9 .37 ; a = b; a 8.5 a ? b 9 .37 b ? What is stored? float someFloat; ? someFloat ... for storing integer values with a limited range Samples of C++ Data Values int sample values 4578 -4578 float sample values 95.274 95 9521E -3 -95E-1 char 265 95.213E2 sample values ‘B’ ‘d’ ‘4’ ... are you?” cin >> age cout
... cin.ignore(100, ‘\n’); cin >> c; a b c 957 34 a b 957 34 a b c 957 34 128 a b c c 957 34 1 235 \n 128 96\n 957 34 1 235 \n 128 96\n 957 34 1 235 \n 128 96\n 957 34 1 235 \n 128 96\n Another Example Using cin.ignore() ... Decomposition • A technique for developing a program in • which the problem is divided into more easily handled subproblems The solutions of these subproblems create a solution to the overall problem ... first trailing whitespace, >> cannot be used to input a string with blanks in it Use the getline function with arguments to overcome this obstacle First argument is an input stream variable,...
... equal, then the strings are equal Otherwise, the string with the character with smaller ASCII value is the “lesser” string http: //www.ascii-code .com/ string myState; string yourState; myState = “Texas”; ... Version int AQIndex; AQIndex = 35 ; if ((50 < AQIndex) && (AQIndex < 80)) cout
... argument list is a way for functions to communicate with each other by passing information The argument list can contain 0, 1, or more arguments, separated by commas, depending on the function Two ... pollution index less than 35 as “Pleasant”, 35 through 60 as “Unpleasant”, and above 60 as “Health Hazard” parameter void DisplayMessage(int index) { if(index < 35 ) cout
... identifier with the same name (local identifiers have name precedence) Name Precedence Implemented by Compiler Determines Scope ● When an expression refers to an identifier, ■ The compiler first ... the identifier isn’t local, the compiler works outward through each level of nesting until it finds an identifier with same name where it stops ● Any identifier with the same name declared at ... PassingMechanism Incoming /* in */ Pass-by-value Outgoing /* out */ Incoming/outgoing /* inout */ Pass-by-reference Pass-by-reference Prototype for float Function AmountDue() is a function with parameters...
... float double long double Minimum Positive Value Maximum Positive Value 3. 4E -38 3. 4E +38 1.7E -30 8 1.7E +30 8 10 3. 4E-4 932 1.1E+4 932 NOTE: Values given for one machine; actual sizes are machine-dependent ... 65, 536 numbers in the range -32 ,768 32 ,767 Some Integral Types Type Size in Bytes Minimum Value Maximum Value char -128 127 short -32 ,768 32 ,767 int -32 ,768 32 ,767 long -2,147,4 83, 648 ... const Boolean false = 0; : Boolean dataOK; : dataOK = true; Combined Assignment Operators int age; cin >> age; A statement to add to age age = age + 3; OR age += 3; A statement to subtract 10 from weight...
... temps [3] temps[4] Initializing in a Declaration int ages[5] = { 40, 13, 20, 19, 36 }; for (int m = 0; m < 5; m++) { cout > bp1 >> bp2 >> bp3; total = bp1 + bp2 + bp3; What if you wanted to store and total 1000 blood pressures? ... temps [3] = 101.2; temps[0] = 99.4; temps[m] = temps [3] / 2.0; temps[1] = temps [3] - 1.2; // What value is assigned? 7000 99.4 temps[0] 7004 7008 ? 98.6 temps[1] temps[2] 7012 101.2 temps [3] 7016...
... } Separate Compilation and Linking of Files specification file main program time.h client.cpp implementation file time.cpp #include “time.h” Compiler Compiler client.obj time.obj Linker client.exe ... “27” 3- element int array 10 45 27 Choice of representation depends on time, space, and algorithms needed to implement operations Some Possible Representations of ADT ComplexNumber struct with ... Specification, cont OPERATIONS Initialize the complex number Write the complex number Add Subtract Multiply Divide Determine the absolute value of a complex number ADT Implementation ADT implementation...
... Deleting 39 from an Unsorted List length data [0] 15 [1] 39 [2] -90 [3] 64 [MAX_LENGTH-1] index: 39 has not been matched item 39 Deleting 39 from an Unsorted List length data index: [0] 15 [1] 39 ... data index: [0] 15 [1] 39 [2] -90 [3] 64 [MAX_LENGTH-1] 39 has been matched item 39 Deleting 39 from an Unsorted List length data index: [0] 15 [1] 64 [2] -90 [3] 64 [MAX_LENGTH-1] Placed copy ... into the position where 39 was before item 39 Deleting 39 from an Unsorted List length data index: [0] 15 [1] 64 [2] -90 [3] 64 [MAX_LENGTH-1] Decremented length item 39 Preparing for Iteration...