Notes from 9/12

bools.cpp

#include <iostream>
using namespace std;
int main()
{
    int x = 5;
    int y = 2;
    bool ok = x < 8 && y > 2;
    if(ok)
    {
        cout << "true\n";
    }
    else
    {
        cout << "false\n";
    }
    cout << ok << endl;    
    return 0;
}

floats.cpp

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    float f = M_PI;
    double d = M_PI;
    cout << f*f*f*f*f << endl;
    cout << d*d*d*d*d << endl;
    return 0;
}

input2.cpp

#include <iostream>
using namespace std;
int main()
{
    int age;
    bool ok = true;
    string name;
    cout << "Your age: ";
    cin >> age;
    cout << "Your name: ";
    cin >> name;
    cout << "Hi, " << name << " (" << age << ")" << endl;
    return 0;
}

input.cpp

#include <iostream>
using namespace std;
int main()
{
    float f = 4;
    cout << "Type an int: ";
    cin >> f;
    cout << "Got " << f << endl;
    cout << "Type a double: ";
    double d;
    cin >> d;
    cout << "Got " << d << endl;
    return 0;
}