0% found this document useful (0 votes)
28 views

Introduction To Computer Science Notes - CS161 Midterm Review

This document outlines the key elements of an algorithm including data types, operators, conditional statements, loops, functions, and strings. It discusses basic data types like int and float, extended types, input/output expressions, arithmetic, comparison, and increment/decrement operators. Conditional statements covered include if/else if/else and switch. Loops discussed are while, do-while, and for. The document also mentions function prototypes, call by value vs reference, and how to handle strings with termination null and input/output expressions.

Uploaded by

Nguyễn Nam Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Introduction To Computer Science Notes - CS161 Midterm Review

This document outlines the key elements of an algorithm including data types, operators, conditional statements, loops, functions, and strings. It discusses basic data types like int and float, extended types, input/output expressions, arithmetic, comparison, and increment/decrement operators. Conditional statements covered include if/else if/else and switch. Loops discussed are while, do-while, and for. The document also mentions function prototypes, call by value vs reference, and how to handle strings with termination null and input/output expressions.

Uploaded by

Nguyễn Nam Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Algorithm
2. Data Types:
- Basic ones: int (4 Bytes, -2^31 to 2^31-1 , the number -1 is explained for
the usage of [empty] ), float (real numbers: how to store?), char, bool
- Extended: double, long long …
- Input & output from/to : stdin, stdout
- Other expressions used for input and output: <<, >>, precision, width …
3. Operators
- Assignments: A = B
- Compound assignment: +=. -=, *=, /=, …
- Arithmetic ops: +, -, *, / (be careful when you divide! You should check the
data types as int/int = int, not float)
- Comparison: >, <, >=, <=, ==
- Increment/ Decrement: ++, -- …
4. Conditional statement
- If … else if … else …
5. Switch (int, char) case
6. Loops: (Be careful with the stopping condition)
- While
- Do … while: at least 1 time
- for
7. Functions (prototypes/declaration, implementation/definition))
- Call by value ( it copies the actual variable to a formal argument)
- Call by reference
8. String: ‘\0’ (this is termination null)
- Input % Output: cin>>str (shouldn’t use this), cin.get( _, _, _ )
- Str[i]: i is index number, [] is subscript operator

You might also like