Question
Write code to assign x and y coordinates to currCoordinate, and store currCoordinate in locations. Input first receives an x value, then a y value.
Write code to assign x and y coordinates to currCoordinate, and store currCoordinate in locations. Input first receives an x value, then a y value. Input example: 12 32 88 2 -1 -1
#include
class Coordinate { public: void SetXAndY(int coordinateX, int coordinateY) { x = coordinateX; y = coordinateY; } void PrintCoordinate() const { cout << x << " - " << y << endl; } int GetX() const { return x; } int GetY() const { return y; }
private: int x; int y; };
int main() { vector
cin >> currX; cin >> currY; while ((currX >= 0) && (currY >= 0)) {
/* Your code goes here */
cin >> currX; cin >> currY; }
for (i = 0; i < locations.size(); ++i) { currCoordinate = locations.at(i); currCoordinate.PrintCoordinate(); }
return 0; }
c++ and please please make it correct
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started