hey, I am a college stundent who was assigned to write a simple beginners C++ program and i needed some help. I am just starting out in the language and I didn't get a chance to go through the assigned readings, For Anyone who is bored, I would really appreciate if you folks wrote this program, Thanks.
include <math.h>
include <iostream.h>
int main() {
double num, den, y;
for (double x = -4.0; x <= 3.0; x += 0.5) {
// Calculate the numerator, storing it in num. You'll need to make calls to the
// function pow(), that's found in the cmath library. An example can be found
// here: http://www.cplusplus.com/reference/clibrary/cmath/pow.html
// Calculate the denomenator, storing it in den. You'll need to make calls to
// the functions fabs() and sqrt(), both are found in the cmath library.
// Examples can be found here:
// http://www.cplusplus.com/reference/clibrary/cmath/fabs.html
// http://www.cplusplus.com/reference/clibrary/cmath/sqrt.html
// The technical aspects of the assignment go something like this.
y = num/den;
cout << "X=" << x << " Y=" << y << endl;
cout << "Y IS ";
if (y == 0)
cout << "ZERO\n";
elseif (y < 0)
cout << "NEGATIVE\n";
else
cout << "POSITIVE\n";
} // End for on x.
return 0;
}