Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок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.
4 ответов
+ 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 ~
+ 2
1. Okay.
2. I did the type detection in case input is not a numerical value.
3. Okay.
4. Okay.
~ swim ~
+ 1
Oh yeah, true...