a) compute the positive values y for x = (a-r) to x=(a+r).
y = b+(sqrt( (r*r) - ((x - a)*(x - a)) ))
b) compute the negative values y for x=(a-r) to x=(a+r).
y = b-(sqrt( (r*r) - ((x - a)*(x - a)) ))
c) compute the maximum value of y.
d) compute the minimum value of y.
e) compute the (y-b)/r for each y value computed in part a) and b) above.
(to find angle A-> this is found by sine rule., (y-b) is the opposite side of angle A and r is the hypoteneuse).
The program should make use of at least two programmer-defined functions.
so far i have done this:
/*-Program name- main.cpp
-Program statement- The equation of a circle given as (r*r) = ((x - a)*(x - a)) + ((y - b)*(y - b)). with centre at coordinate points x=a, y=b and radius r. we have to solve y given y = b+/-( ( r2 -(x - a)2 )).
-Inputs- float a, b, r, x, y.
-Outputs- y = b+/-( ( r2 -(x - a)2 )), min and max value of y, angle A
*/
#include <iostream>
#include <cmath>
using namespace std;
//start of main function
int main()
{
float a = 1;
float b = 1;
float y1;
float y2;
float x = 1;
float r = 5;
float max_y;
float min_y;
float angle1;
float angle2;
//using for loop for value of x
for ( x = -1; x <=5; x = x + 1)
{
//Function call statement
after i compile the program it displays an invalid value of the angle. can you tell me what i have done wrong? and why i am getting an invalid answer? everything else is alright, i think.