We're supposed to write a function that calculates both the x and y coordinates of the upper left corner of the square that just contains a circle, given the x and y coordinates of the center of the circle, and the radius of the circle. Return the x and y coordinates of the upper left corner of the square to the calling function.
I have the function write, but I don't know how to just return the value from the function without outputting anything. Please help. Here's my code:

2. int x_y_square_coordinates (int circle_x, int circle_y, int circle_radius, int& square_x, int& square_y)
3. {
6. return square_x, square_y;
7. }

8. int main()
9. {
10. cout << "Enter the x and y coordinates of the center of the circle and the radius of the circle." << endl;
11. cout << "x:";
12. cin >> circle_x;
13. cout << "y:";
14. cin >> circle_y;

18. cin.get();
19. getchar();

20. return 0;
21. }
2
Contributors
1
2
Views
9 Years
Discussion Span
Last Post by VernonDozier

Code tags. And don't add the numbers. The code tags will do that:

[code=cplusplus] // paste your code here

[/code]

``````int circle_x, circle_y, circle_radius, square_x, square_y;

int x_y_square_coordinates(int circle_x, int circle_y, int circle_radius, int& square_x, int& square_y)
{
return square_x, square_y;
}

int main()
{
cout << "Enter the x and y coordinates of the center of the circle and the radius of the circle." << endl;
cout << "x:";
cin >> circle_x;
cout << "y:";
cin >> circle_y;