EECS 183 Exam 1 Flashcards
12 Questions
100 Views

EECS 183 Exam 1 Flashcards

Created by
@EvaluativeQuantum

Questions and Answers

How to cin everything (including spaces)?

getline(cin, stringVar)

What is the cout operator?

What is the range of int variables?

+/- 2 billion (2,000,000,000)

How to initialize a constant?

<p>CONST_VAR</p> Signup and view all the answers

Is 'doubleVar = 36 * intVar' an int or double?

<p>False</p> Signup and view all the answers

What is ==?

<p>Equal to operator</p> Signup and view all the answers

What is =?

<p>Assignment operator</p> Signup and view all the answers

What is a function declaration?

<p>return type function name (parameter list);</p> Signup and view all the answers

What is a function definition?

<p>return type function name(parameter list) { code of function }</p> Signup and view all the answers

What is ASCII order?

<p>0 - 9, A - Z, a - z</p> Signup and view all the answers

How to compare floating point numbers?

<p>NOT ==, fabs(x - y) &lt; .0001</p> Signup and view all the answers

What is the order operators evaluated?

<p>( ) !arithmetic &gt;</p> Signup and view all the answers

Study Notes

Input and Output in C++

  • Use getline(cin, stringVar) to read input from the user that includes spaces.

Output Operator

  • The cout operator is represented by the symbol > for outputting text and values to the console.

Integer Range

  • The range of int variables spans approximately ±2 billion, specifically from -2,147,483,648 to 2,147,483,647.

Constant Initialization

  • A constant variable is initialized using the identifier format CONST_VAR.

Variable Type Evaluation

  • When evaluating the expression doubleVar = 36 * intVar, the resulting type is an int but may be displayed as a double with decimal points (e.g., 36.00).

Equality Operator

  • The == operator is used to check if two values are equal.

Assignment Operator

  • The = operator serves as the assignment operator, used to assign values to variables.

Function Declaration

  • A function declaration follows the format: return type function name (parameter list); indicating its return type, name, and parameters.

Function Definition

  • A function definition is structured as: return type function name(parameter list) { code of function }, containing the implementation details.

ASCII Order

  • In ASCII, characters are ordered from 0-9, followed by A-Z, and then a-z, indicative of numerical and alphabetical sorting.

Comparing Floating Point Numbers

  • For comparing floating point values, avoid using == or !=. Instead, use fabs(x - y) < 0.0001 to check for equality and fabs(x - y) > 0.0001 to check for inequality.

Operator Precedence

  • The order of operators evaluated in expressions follows this hierarchy: parentheses ( ), logical NOT !, arithmetic operations, and then relational operators like >.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge on the basics of C++ programming with these flashcards from EECS 183. Each card covers fundamental concepts such as input/output streams, data types, and variable initialization. Perfect for preparing for Exam 1!

More Quizzes Like This

Use Quizgecko on...
Browser
Browser