






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Class: Programming & Problem Solving I; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Unknown 1999;
Typology: Study notes
1 / 11
This page cannot be seen from the preview
Don't miss anything!







CECS 174 Programming and Problem Solving I covers the basics of programming. After taking CECS 174, you should: be able to write simple programs understand the basics of C++ be familiar with simple types, structs, classes and arrays understand how to compile and execute C++ programs This course, CECS 274 Programming and Problem Solving II, will focus on the tools you need to solve sophisticated problems with the computer.
An alternative name for this course might be: the design and implementation of algorithms and data structures used in computer science. Defn: An algorithm is a list of instructions to accomplish a given task. An algorithm has: ˙ 0 or more inputs ˙ 1 or more results ˙ unambiguous instructions ˙ a finite number of steps in which it terminates Defn: A data structure is a concrete organization imposed on a collection of data.
(1) Software Life Cycle (or the Engineering Process) Requirements Specification Clearly state the problem and understand what is needed for its solution. Analysis Identify the components of the problem (input, output, etc.). Design Create a solution to the problem and document the solution. Develop a Test Plan Decide how the correctness of the program will be determined. Implementation or coding Do the programming. Testing Systematically test the program. Operation Use the software. Maintenance Update or modify the program.
(2) Goals of Software Engineering (or The Characteristics of “Good” Software) Correctness Does the software meet its specifications? Predictability Does the software always behave in a predictable, understandable manner? Understandability Can the software code be understood and maintained? Modifiability Can the software be easily changed to meet new needs? Reusability Can the software be used in other systems? Efficiency Does the software make optimal use of computer resources--time, memory, I/O devices?
Strongly vs. Weakly Typed Languages Defn: A language is strongly typed if
Example Problem With Typing C++ will let you do the following: float Ans; int A, B; ... A = 7; B = 2; Ans = A / B; ... We would like the value stored in Ans to be 3.5, but C++ will do integer division on A and B. Thus, Ans will have the value 3.0. Probably not what the programmer wants! In Ada, Ans = A / B would never even be compiled successfully because Ans has a different type from A and B. Thus, this problem would not occur.
Scalar Types (or Simple Types) In a scalar type, each value has a single component. Examples: Integer types int Flavors; short ShortInt; long LongInt; Floating-point types float Temp; double DoubleVar; Enumeration types enum Colors {Red, Green, Blue};
Composite Types (or Structured Types) In a composite type, each value can have multiple components. Examples: Record Types (or Structures) struct SampleRec { Type1 Field1; Type2 Field2; … TypeN FieldN; }; Class Types class Class1 { public: void function1(); … private: int intVar; … }; Array Types int intArray[10]; or const int MAX =10; float FloatArray[MAX];