Today I would not write this but use OpenCV or other libraries. Example at https://cppsecrets.com/users/204211510411798104971091085153504964103109971051084699111109/C00-OpenCV-to-rotate-an-image.php
Remember you didn't reveal enough to propose a solution. Also, we never used float to locate the image center.