Unit 1a – C++ Syntax & Expressions

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

11 Terms

1
New cards

What is the << operator called in cout?

The stream insertion operator

2
New cards

What are the main C++ data types?

Integers, floats, text, boolean

3
New cards

What are escape sequences in C++?

\n = newline, \t = tab, \\ = backslash, \' = apostrophe

4
New cards

What happens if you exceed type limits?

Overflow/underflow

5
New cards

Why is hex used in debugging?

Memory is binary, but hex is shorter and easier to read

6
New cards

What are types?

Indicate how many bits/bytes of storage are required and how to interpret the number being stored

7
New cards

What are expressions in C++?

Combinations of variables, values, and operators. Examples:

Integer division: 5 / 2 = 2

Modulo: 5 % 2 = 1

8
New cards

What is casting?

Converting one type to another. Example: (double) 5/2 = 2.5

9
New cards

How do you generate random numbers?

srand(time(0));    // seed random

int r = rand();    // random int

RAND_MAX is the maximum random value.

10
New cards

Seeding:

srand(int seed) lets us make each run of generated numbers different

11
New cards

What are basic math functions in <cmath>?

pow(x,y), sqrt(x), sin(x), cos(x), abs(x)