quadrant problem

I'm trying to have all the functions to show in their own quadrant when I input the numbers in. (Cartesian graph) Everything else is perfect except for the quadrant part at bottom. I've been at it for 4 hours..


int main()
{




float x,y;


char choice;

cout << "A - y = 3(x+2)^2 \n" ;
cout << "B - y = -3x + 2 \n" ;
cout << "C - y = 2x^3 + x^2 - 3x \n" << endl;

cin >> choice;
while ( choice < 'A' || choice > 'C');

switch (choice) {

case 'A':
cout << "Enter x value: \n";
cin >> y;
y = 3 * pow(x+2,2);

cout << "The value of 3(x+2)^2 is: \n";
cout << y << endl;


break;
case 'B':
cout << "Enter x value: \n";
cin >> y;
y = 2 -3 * x;

cout << "The value of -3x + 2 is: \n";
cout << y << endl;

break;
case 'C':
cout << "Enter x value: \n";
cin >> y;
y = 2 * pow(x,3) + pow(x,2) - 3 * x;

cout << "The value of 2x^3 + x^2 - 3x is:";
cout << y; "\n";


break; endl;

---------------------------- This part down here

if ((x > 0)&&(y > 0))
cout << "Quadrant 1";


else if ((x < 0)&&(y > 0))
cout << "Quadrant 2";


else if ((x < 0)&&(y < 0))
cout << "Quadrant 3";


else if ((x > 0)&&(y > 0))
cout << "Quadrant 4";


cout << "The point: "; x,y;
cout << "lies in Quadrant: ";

---------------------------------------
how do i get the quadrant working, throw a hint, something i'm missing. but be specific


EDIT: sorry
Last edited on
how do i get the quadrant up and working?

by learning how to correctly write C++ codes, have a good idea on how your program should work, know what you're supposed to solve & learn how to ask and post questions the right way
[code] "Use code tags" [/code]
1
2
cout << "Enter x value: \n";
cin >> y;

1
2
while ( choice < 'A' || choice > 'C')
   ; //infinite loop 
after if {}
Topic archived. No new replies allowed.