100 likes | 204 Views
Review for Midterm Exam. CSCI 1380. Contents. 5 questions (20 points each) + 1 bonus question (20 points) Chapters 1~4 Question types Write down the output of the code Write the code Debug errors in the code Review Lecture slides Exercises (1)~(5) in class (on the course Web page)
E N D
Review for Midterm Exam CSCI 1380
Contents • 5 questions (20 points each) + 1 bonus question (20 points) • Chapters 1~4 • Question types • Write down the output of the code • Write the code • Debug errors in the code • Review • Lecture slides • Exercises (1)~(5) in class (on the course Web page) • Review problems
Time & Place & Event • 5:45pm ~ 7:00pm, Feb. 28, Tuesday • ENGR 1.262 • Closed-book exam • You can take a piece of cheating paper with A4 size • Write down whatever that you think is important (on both sides) with any font size
Chapter 1: An Overview of Computers and Programming Languages • Computer system has hardware and software • Various kinds of languages, such as machine language, assembly, high-level • Algorithm: step-by-step problem-solving process; solution in finite amount of time • Object-oriented design (OOD): a program is a collection of interacting objects • C++ is an object-oriented programming language
Chapter 2: Basic Elements of C++ • Special symbols, keywords, rules of identifiers • Basic data types • int, float, double, char, string • Operators • Arithmetic operators and their precedence • +, -, *, /, %, +=, -=, *=, /= • Increment/decrement operator • ++, -- • Declaration of variables • int first=13, second=10; • char ch=' '; • Input/Output statement • cin and cout
Chapter 3: Input/Output • Declaration of input/output stream • Usage of cin and cout (as well as other istream/ostream variables) • The stream extraction operator, cin>> • Syntax and meaning of functions • cin.get(varChar); • cin.ignore(intExp, chExp); • cin.putback(ch) • cin.peek(ch) • getline(cin, str); • See examples in lecture slides
Chapter 3: Input/Output (cont'd) • The stream insertion operator, cout<< • endl • setprecision, showpoint, setw, setfill • File stream • Header: fstream
Chapter 4: Control Structures I (Selection) • Relational operators and precedence • Comparison operators • <, <=, >, >=, ==, != • String comparison • Logical operators • &&, | | • Evaluation of logical expression • See examples in lecture slides
Chapter 4: Control Structures I (Selection, cont'd) • Syntax and usage of the selection structure • One-way selection: if () { } • Compound statements • Two-way selection: if () { } else { } • Multi-way selection: switch () { } • Nested if statement • See examples in lecture slides
Good Luck! Q/A