I am writing a graphing program and I have the basic concept down but still having problems. If someone could help that would be great, I dont know "char" functions or "strcpy" functions. Look at the code I have and you should be able to tell what I know. Thank You.
#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: "; //All of these work fine
cin >> x;
cout << "Please enter the y coordinate: ";
cin >> y;
//When the program is run it asks for the coordinates and if you want to continue but wont display
//the sum of the equation
while (answer == Yes) //Thought this what I thought would work
if ((x > 0)&&(y > 0))
{
cout << "Quadrant I" << endl;
cout << "Do you want to continue (\"Yes\"" << " or \"No\"" << ")? ";
cin >> answer; //Not sure this is where it should go.
cout << endl;
}
else
{
quad1 = quad1 + counter; //This seems to only equal 0
cout << "There are " << quad1 << " point(s) in quadrant 1" << endl;
}
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int x, y, quad1=0;
string answer("Yes"); // set string to "Yes" at the start
while (answer == "Yes") //Thought this what I thought would work
{
cout << "Please enter the x coordinate: "; //All of these work fine
cin >> x;
cout << "Please enter the y coordinate: ";
cin >> y;
if ((x > 0)&&(y > 0))
{
quad1++;
cout << "Quadrant I" << endl;
}
cout << "Do you want to continue (\"Yes\"" << " or \"No\"" << ")? ";
cin >> answer;
}
cout << "There are " << quad1 << " point(s) in quadrant 1" << endl;
}