// File: arithmetic.cxx
// Written by: Dmitry and Michael
// This program shows some of the C++ arithmetic operations
// as well as input and output.
//
// Five ways to change the value of a variable, including input.
// Printing the value of a variable.
// Arithmetic expressions.

#include <iostream>
using namespace std;

int main( )
{
    int i;
    double x;

    // assignment statements
    i = 42;
    x = 3.14;
    cout << i << " " << x << endl;

    //changing operations
    i += 10;
    x += 1.9;
    cout << i << " " << x << endl;

    ++i;
    cout << i << " " << x << endl;

    --i;
    cout << "i = " << i << ", x = " << x << endl;

    x = 10.8 + i;
    cout << "i = " << i << ", x = " << x << endl;

    i = int( x * 2 );
    cout << "i = " << i << ", x = " << x << endl;

    x = 7 + x;
    cout << "i = " << i << ", x = " << x << endl;

    i = 0;
    while (i < 10)
    {
	cout << i * 8 << endl;
	++i;
    }

    i = 0;
    while (i < 10)
    {
	cout << i / 8 << endl;
	++i;
    }

    i = 0;
    while (i < 10)
    {
	cout << i / 8.0 << endl;
	++i;
    }

    
    i = 0;
    while (i < 100)
    {
	cout << "Remainder: " << i << " devided by 8 is " << i % 8 << endl;
	++i;
    }

    cout << "Please type the value of i: ";
    cin >> i;
    cout << "Please type the value of x: ";
    cin >> x;
    cout << "i = " << i << ", x = " << x << endl;

}
