While loop homework

I have another homework assignment that is asking:

Write a program that asks the user for points in a graph.
Determine what quadrant the points are in and display an appropriate message.
Ask if the use wants to continue, and if the answer is "yes" then continue, otherwise do not. Count how many points were in each quadrant and display the count at the end. If the point is on either axis, display a message and do not count it.

a while loop must be used in this to have keep asking for points until you say no i dont know anything fancy just basic stuff. here is the code i have so far:


#include <iostream>
#include <string>
using namespace std;
int main()
{
int x, y, counter=1, quad1=0, quad2, quad3, quad4;
string answer, Yes, No;
cout << "Please enter the x coordinate: ";
cin >> x;
cout << "Please enter the y coordinate: ";
cin >> y;

while (answer == Yes)
{
if ((x > 0)&&(y > 0))
{
cout << "Quadrant I" << endl;
cout << "Do you want to continue (\"Yes\"" << " or \"No\"" << ")? ";
cin >> answer;
}
}
}
Last edited on
while (answer == Yes)
Tell me, what value does the string named Yes have? Here's a hint; it does not have the value "Yes".
Last edited on
Topic archived. No new replies allowed.