Sensei

Attention!
I finished most of the papers due and I now have some time to spare to start on the next lesson I t should be out very soon. 
Eating spacetime


Sensei

fruitschinposamurai wrote: Attention! I finished most of the papers due and I now have some time to spare to start on the next lesson I t should be out very soon. Awesome lol I'll try if I can manage my class AHAHAHA!! 
Megabaa!!!


Sensei

Lesson 3
Today we are going to learn about mathematical operations in C++ If you are familiar with basic algebra this should make complete sense. so lets set the value of a to be 4 and lets set the value of b to be 3 a+b a*b a/b ab a%b The first expression is quite simple it is merely a plus b, if you substitute the values of a and b in the answer would be 7. The second expression is a multiplied by b. The asterisk symbol is commonly used for multiplication, and the answer would be 12. The third expression is a divided by b or 4/3 (note that this is not an integer value). The fourth is selfexplanatory. The fifth is pronounced a modulo b. It is the remainder left after dividing a by b. so the answer would be 1. Like algebra in C++ variables can go through the above operations with other variables or numbers. A variable can also set its value to an expression involving two other variables. For Example: int a; int b; int c; a = 2; b = 4; c = a+b; Now c has a value of 6, because a(2) plus b(4) equals c(6). This is very useful in C++ because it makes complicated operations much simpler Example 2: int a; int b; int c; a = 123; b = 456; c = a * b; And like algebra parentheses can be used because the order of operations is followed so if you wrote a  (b/c) it would be considered valid in C++. This seems like a lot to absorb so I will finish the lesson with an assignment. Assignment 1. Write a program in C++ with four variables 2. I want the first variable to be given a value of 14 3. I want the second variable to be the first squared 4. I want the third variable to be the first cubed 5. I want the last variable to be the first to the fourth power. 6. Then use to cout command to put each of these values on a separate line Note: Remember to use endl as follows int a; int b; cout << a << endl; cout << b << endl; 
Eating spacetime


here's my assignment
Spoiler Alert! Click to show or hide #include "stdafx.h" #include <iostream> using namespace std; int main() { int a; int b; int c; int d; a = 14; b = a * a; c = a * a * a; d = a * a * a * a; cout << a << endl; cout << b << endl; cout << c << endl; cout << d << endl; char e; cin >> e; } 

You gotta eat when you can!


Sensei

Good job Musashidono you did perfectly and i will tell you guys a trick
int a; int b; int c; is the same as int a, b, c; 
Eating spacetime


Sensei

What happened to my class????

Eating spacetime


Student

Don't worry... it seems that all classes have a tendency to do this... I think it might help if people had an incentive

Firelies~~ >o<
