/*
Name: Zach Hoggard
Student No.: 250 611 551
Email: zhoggard@uwo.ca
Section: 004
Date: February 8, 2012
*/
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
//Declare variables
double x, y;
//Display the program discription
cout << "This program calculates the value y = ( 4 - x * x ) ^ (1/2)\n";
//Ask the user to input a value for x. If the value of x is not between -2 and 2, ask the user to input another value for x until the value is between -2 and 2.
do {
cout << "Please enter a value for x: "; cin >> x;
} while (!(x >= -2 && x <= 2));
//Solve the equation
y = sqrt (4 - x * x);
//Display the result for y
cout << "The result for y = " << y;
//Terminate the program
return 0;
}