
C++ Operators
Presentation
•
Computers
•
9th - 12th Grade
•
Medium
Michael Ask
Used 14+ times
FREE Resource
6 Slides • 4 Questions
1
C++ Operators
by Michael Ask
2
Operators
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
Operators
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
Operators and Output
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
Limitations
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
Kinds of Operators
C++ Operators
by Michael Ask
Show answer
Auto Play
Slide 1 / 10
SLIDE
Similar Resources on Wayground
9 questions
Users and Security threats: Part 2
Presentation
•
9th - 12th Grade
9 questions
MATERI
Presentation
•
9th - 12th Grade
6 questions
HTML -Επικεφαλίδες
Presentation
•
10th - 12th Grade
9 questions
Fallacy of the Day: Strawman
Presentation
•
9th - 12th Grade
7 questions
The Iliad, Books XVIII-IXX
Presentation
•
9th - 12th Grade
9 questions
Reference Angle
Presentation
•
9th - 12th Grade
6 questions
التنسيق باستخدام وسوم HTML
Presentation
•
9th - 12th Grade
8 questions
Solving Radical Equations
Presentation
•
9th - 12th Grade
Popular Resources on Wayground
20 questions
Math Review
Quiz
•
3rd Grade
15 questions
Fast food
Quiz
•
7th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
10 questions
Identify Fractions, Mixed Numbers & Improper Fractions
Quiz
•
3rd - 4th Grade
Discover more resources for Computers
10 questions
Fact Check Ice Breaker: Two truths and a lie
Quiz
•
5th - 12th Grade
10 questions
Video Games
Quiz
•
6th - 12th Grade
10 questions
Logos
Quiz
•
6th - 9th Grade
10 questions
Test Your Knowledge with 15 Fun Trivia Questions
Interactive video
•
6th - 10th Grade
15 questions
Memorial Day Trivia
Quiz
•
KG - 12th Grade
21 questions
Factoring Trinomials (a=1)
Quiz
•
9th Grade
12 questions
Name that Candy
Quiz
•
KG - 12th Grade
22 questions
Regular Preterite -AR-ER-IR-
Quiz
•
12th Grade