Strings, Conditionals, Logical Operators
Today we learned a few very important things:
1) = is used to assign a value to a variable
2) A "scope" is defined by a {} pair, and is the home of a variable. You can make at most one variable with the same name in a scope
3) Ints range from -2.1B to 2.1B; floats have error in them
4) if statements can be used to do one thing or another. You can use if / else if / else blocks to do different things in different situations.
5) Inside an if statement's parenthesis () you can put comparison operators, like if (x == 5), and so if x is five, it will run the code in the scope after it. You can do less than, greater than, less than or equal to, greater than or equal to, equal to (== is comparison, = is assignment!!!) and not equal to (!=).
6) If you want more complex comparisons, you can join together multiple comparison operations with logical operators: and (&&), or (||) and not (!)
7) Strings hold zero or more characters, and are used to hold things like names and addresses. When you do a cin statement into a string you get one word (so if you type in "Bob Hope" the cin will read only "Bob" and leave "Hope" in the input buffer for the next cin).
Other Videos By Bill Kerney
2021-08-23 | UNIX Shortcuts, C++ Shortcuts, Bools |
2021-08-23 | Welcome to CSCI 1 @ Fresno State! |
2021-08-20 | Conditionals Part III |
2021-08-20 | Navmesh, Materials, Axis-Aligned Bounding Boxes |
2021-08-19 | Multiplayer Balance and UE4 Materials Pt. 2 |
2021-08-19 | The Optimizer, Bigints, Prime Generation, RSA Encryption, Cryptographic Hashing |
2021-08-18 | Conditionals Part II |
2021-08-17 | Line Rasterization |
2021-08-17 | Game Design Principles and UE4 Materials |
2021-08-17 | Powm, Modular Division, Espionage |
2021-08-16 | Strings, Conditionals, Logical Operators |
2021-08-13 | C++ Variables, Algebra, I/O |
2021-08-12 | Week 1 Day 2 - Introduction to Rendering |
2021-08-12 | Week 1 Day 2 - Game Design / Intro to UE4 |
2021-08-12 | Week 1 Day 2 - More Modulus |
2021-08-12 | Week 1 Day 2 - UNIX and Vim Basics; Hello World |
2021-08-10 | CSCI 26 Week 1 Day 1 Lecture |
2021-08-10 | IS50A Game Development Week 1 Day 1 |
2021-08-10 | IS50B Fall 2021 Week 1 Day 1 |
2021-08-09 | Week 1 Lecture 1 - Welcome to Computer Science |
2021-07-30 | Week 4 Day 5 - Presentations |