Hi guys, so I made this little thing for a bit of fun lol, just to see if I knew how to use simple classes properly (because I'm learning about them), all works perfectly except for the fact that when I enter a integer such as 15, it doesn't return a remainder for the result. If I enter 15 then it should return 14.5 but it returns 14. Which leads me to believe that something is wrong with the float? I have no idea, I can't see anything wrong Here is the code:
Code:#include <iostream> using namespace std; class agetest { public: unsigned float calc_age(unsigned float); }; void main() { unsigned int age; cout << "Is your girlfriend too young for you? Find out the easy way!" << endl << "Enter your age: "; cin >> age; cin.ignore(); agetest person; cout << "You shouldn't be dating anyone younger than: " << person.calc_age(age); cin.get(); } unsigned float agetest::calc_age(unsigned float age) { age = age / 2 + 7; return age; }