Review
#include <iosctream>
using namespace std;
void mystery(int &a, int b){
a *= 2;
b *= 2;
}
int main() {
int x = 3, y = 5;
myster(x, y);
cout << x << " " << y << endl;
return 0;
}

#include <iosctream>
using namespace std;
void mix_it_up(char v1, char &v2, char v3){
char v4 = ' ';
v4 = v1;
v1 = v2;
v2 = v3;
v3 = v4;
}
int main() {
char x = 'a', y = 'b', z = 'c';
mix_it_up(x, y, z);
cout << x << y << z << endl;
return 0;
}

Handout
#include <iostream>
using namespace std;
int main(){
int sum = 5;
sum += '6';
sum -= '0'; // add this line to solve the solve
cout << sum << endl;
}
Predefined Functions in C++
- C++ comes with “built-in” libraries of predefined functions
cmath
- Standard math library in C++
- Contains several useful math functions, like
cos()
, sin()
,exp()
,log()
,pow()
,cos()
,sqrt()
- To use it, you must import it at the start of your program
#include <cmath>
- You can find more information on this library at: http://www.cplusplus.com/reference/cmath/
pow(x, y)
- Returns xy
- Return value is of type double
- Arguments are of type double