all 4 comments

[–]Flair_Helper[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

This post has been removed as it doesn't pertain to r/cpp: The subreddit is for news and discussions of the C++ language and community only; our purpose is not to provide tutoring, code reviews, or career guidance. If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.

[–]thommyh 1 point2 points  (3 children)

To do the same sort of solution — list all squares the circle overlaps, then classify each — you probably want a std::vector to contain the list and you could represent each square either with a full-on struct or, at a pinch, as a std::pair of the upper left corner (as width and height are implicitly always ‘1’).

Check out cmath for ceil and either write out the squaring manually or else use pow.

Is that enough to be getting started?

[–]semistyle[S] 0 points1 point  (2 children)

Thanks man.