# Discussion 9-29

## Variables

We wrote variables.cpp, which shows the basics of using a variable in C++, including how to declare the variable, set it to a value, and print it out.

## Arithmetic with integers

We wrote arithmetic.cpp. This program prints out tons of text. We used it as a test, so we could figure out how the arithmetic operators work in C++. The main takeaways were:

1. You don't need to know about the lines with "for" for now! That will show up later in the course; I just used it so I could quickly create those big lists of printouts.
2. Addition (+), subtraction (-), and multiplication (*) work just like you'd expect.
3. Division (/) is a little confusing: if the answer is a decimal, C++ will ignore anything after the decimal point. For example, 5/2 becomes 2 and 399/100 becomes 3.
4. % is called the "modulo operator". a % b returns the remainder when you divide a by b. For example, 5%2 becomes 1 and 399%100 becomes 99.
5. Exponents: the ^ operator is NOT what you'd expect. You don't need to know anything about it for this class. If you want to use exponents in your code, you need to do it some other way. (Lecture will cover this soon enough.)