#include <iostream>
#include <iomanip>
#include <cfloat>
#include <climits>
#include <cmath>

// the sample function for part 6
//  - computes and returns x squared plus y squared
double rootOfSumSquares(double x, double y);

int main()
{
   // this is the part 1 code section
   int numerator, denominator, quotient, remainder;

   std::cout << "Please enter two integers" << std::endl;
   std::cin >> numerator >> denominator;

   quotient = numerator / denominator;
   remainder = numerator % denominator;

   std::cout << "After dividing " << numerator << " by " << denominator;
   std::cout << " the result is " << quotient << " with a remainder of ";
   std::cout << remainder << std::endl;

   // this is the part 2 code section
   int bigInt = INT_MAX;
   float bigFloat = FLT_MAX;
   std::cout << "The biggest int is " << bigInt;
   std::cout << ", and the biggest float is " << bigFloat << std::endl;
   bigInt = 1 + bigInt;
   bigFloat = 2 * bigFloat;
   std::cout << "After adding 1 the big int, its new value is " << bigInt << std::endl;
   std::cout << "After doubling the big float, its new value is " << bigFloat << std::endl;

   // this is the part 3 code section
   char userInitial, testChar;
   testChar = '!';
   std::cout << "Please enter your initial: ";
   std::cin >> userInitial;
   std::cout << "You entered " << userInitial << "(" << testChar << ")" << std::endl;

   // this is the part 4 code section
   const int ColWidth = 15;
   std::cout << std::setw(ColWidth) << numerator << std::endl;
   std::cout << std::setw(ColWidth) << denominator << std::endl;
   std::cout << std::setw(ColWidth) << userInitial << std::endl;
   std::cout << std::setw(ColWidth) << "and this!" << std::endl;

   // this is the part 5 code section
   std::cout << std::setiosflags(std::ios::fixed);
   std::cout << std::setprecision(5);
   const double Pi = 3.1415;
   double third = 1/3.0;
   std::cout << Pi << std::endl;
   std::cout << third << std::endl;

   // this is the part 6 code section
   double xVal, yVal;
   double answer;
   std::cout << "Enter two numeric values" << std::endl;
   std::cin >> xVal >> yVal;
   answer = rootOfSumSquares(xVal, yVal);
   std::cout << "For inputs " << xVal << " and " << yVal;
   std::cout << " the root of the sum of their squares is ";
   std::cout << answer << std::endl;
}

double rootOfSumSquares(double x, double y)
{
   double sumSqs; // will hold the sum of the squares
   double root; // will hold the square root of the sum
   sumSqs = x*x + y*y;
   root = sqrt(sumSqs);
   return root;
}

