0

How to detect both floats and integers to make math more proper than it currently is? Check my code as of now below:

This may be a bad approach, I appriciate feedback and some bug reports and I could maybe fix it - https://code.sololearn.com/cVRFsFNb2n9x/?ref=app I started learning C++ just today! I want it to be able to do math like 2.5 + 2.5 and return 5 instead of just integers like 2 + 2 which returns 4.

14th Apr 2019, 6:03 PM
Ragey
Ragey - avatar
7 Réponses
+ 2
Ah yes, I noticed it prompting for input. Thus the asking for input option, in case a user would copy the code and run it. And thanks, doing double helped, the code works better now. Any more ideas on improvements to the code? ~ swim ~
14th Apr 2019, 6:31 PM
Ragey
Ragey - avatar
+ 2
1. Okay. 2. I did the type detection in case input is not a numerical value. 3. Okay. 4. Okay. ~ swim ~
14th Apr 2019, 6:52 PM
Ragey
Ragey - avatar
+ 1
Oh yeah, true...
14th Apr 2019, 6:59 PM
Ragey
Ragey - avatar
14th Apr 2019, 7:29 PM
Keekie Iove