Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #define m_height 6
  5. #define m_width 5
  6. using namespace std;
  7. int a[125][125];
  8. void circle(int *ptr, int cx, int cy, int ray)
  9. {
  10. for (int i = 0; i < m_height; i++)
  11. for (int j = 0; j < m_width; j++) {
  12. if (ceil(sqrt((i - cx)*(i - cx) + (j - cy)*(j - cy))) == ray) {
  13. *(ptr + (i*m_width + j)) = 1;
  14. }
  15. }
  16. for (int i = 0; i < m_height; i++) {
  17. for (int j = 0; j < m_width; j++)
  18. cout << *(ptr + (i*m_width+j)) << ' ';
  19. cout << '\n';
  20. }
  21.  
  22.  
  23. }
  24. int main()
  25. {
  26. circle(&a[0][0], 5, 4, 2);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement