
C++ Operators
Presentation
•
Computers
•
9th - 12th Grade
•
Medium
Michael Ask
Used 15+ times
FREE Resource
6 Slides • 4 Questions
1
by Michael Ask
2
Operators allow you to perform mathematical operations in C++. Like this...
3 + 3;
x / 2;
(x + y) / 2;
Notice the use of addition and division.
3
Multiple Select
What other operations do you guess C++ allows?
Multiplication
Exponents
Subtraction
4
Mathematical operations aren't ALWAYS used in code. Just most of the time. So it's important to understand how they work. In this code, the computer will make three variables. The third is the sum of the first two.
int x = 3;
int y = 4;
int z = x + y;
5
While C++ performs any operation that you ask it to, it will only print it for you to see if you request it. This code...
3 + 3;
... will work, but it will give you an error telling you that you didn't use the expression. IF you wish to see the result, you must output it. Like this...
cout << 3+3;
6
Multiple Choice
Mark wants to know what 40 - 32 is, so he types it in like this...
cout << 40 + 32;
Will it work?
No
Yes
7
Multiple Choice
To print the sum of 45 and 76, what should you type?
cout << 45 + 76;
cout >> 45 + 76;
45 + 76;
45 - 76;
8
Operators can only work in certain situations. For instance, you CANNOT add a number to a string. What would that even mean?
"Mr Ask" + 97;
This will throw an error because they are an incompatible pair of data. But C++ is even more picky. This code also does not work.
"Mr " + "Ask"
9
Multiple Choice
What would be the output of this code?
cout << 10 / 2;
5
8
20
10
by Michael Ask
Show answer
Auto Play
Slide 1 / 10
SLIDE
Similar Resources on Wayground
3 questions
8) Protecting Data Part 1
Presentation
•
9th - 12th Grade
7 questions
1.1 Getting to Know Excel
Presentation
•
9th - 12th Grade
7 questions
JavaScript Function Review
Presentation
•
9th - 12th Grade
7 questions
03.02 Browser
Presentation
•
9th - 12th Grade
7 questions
Pelatihan FPD
Presentation
•
KG
8 questions
H CS - Environmental impact (revision)
Presentation
•
9th - 12th Grade
8 questions
расшифровка анаграмм
Presentation
•
9th - 12th Grade
10 questions
Grammar 4A - ir + a + infinitive
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
How much do you know about our Portrait of an Eagle?
Quiz
•
10th Grade
10 questions
Fast Food Slogans
Quiz
•
6th - 8th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
16 questions
Subject & Predicate
Quiz
•
5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
12 questions
Map Skills
Quiz
•
3rd Grade
22 questions
Continents and Oceans
Quiz
•
5th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
20 questions
[AP CSP] Python Coding: Functions, Parameters, Return
Presentation
•
9th - 12th Grade
40 questions
Introduction to Microsoft Word
Quiz
•
8th - 12th Grade
20 questions
APCS Unit 1A
Quiz
•
9th - 12th Grade
24 questions
Binary
Quiz
•
9th - 12th Grade