Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- #define m_height 6
- #define m_width 5
- using namespace std;
- int a[125][125];
- void circle(int *ptr, int cx, int cy, int ray)
- {
- for (int i = 0; i < m_height; i++)
- for (int j = 0; j < m_width; j++) {
- if (ceil(sqrt((i - cx)*(i - cx) + (j - cy)*(j - cy))) == ray) {
- *(ptr + (i*m_width + j)) = 1;
- }
- }
- for (int i = 0; i < m_height; i++) {
- for (int j = 0; j < m_width; j++)
- cout << *(ptr + (i*m_width+j)) << ' ';
- cout << '\n';
- }
- }
- int main()
- {
- circle(&a[0][0], 5, 4, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement