Checkpoint 8.5.1.
What will print?
struct Coordinate {
int x, y;
};
void printOppositeCoordinate(Coordinate p) {
cout << "(" << -p.y << ", " << -p.x << ")" << endl;
}
int main() {
Coordinate coord = { 2, 7 };
printOppositeCoordinate (coord);
}
(-2, -7)
- Take a close look at the printOppositeCoordinate function.
(2.0, 7.0)
- Take a close look at the printOppositeCoordinate function.
(-7, -2)
- Yes, this is the correct output.
(-7.0, -2.0)
- Take a close look at the Coordinate struct.