0

Can we have fraction entry in c++ ( for ex 5/11)

17th Aug 2019, 5:11 AM
Aryan
Aryan - avatar
2 Respuestas
+ 1
Aryan treat it as string and manipulate accordingly.... directly as digits you can not store it... also you can have class which has two different variable of type int to store 5 and 11
17th Aug 2019, 5:15 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Hi Using a class would be a sophisticated way of doing it. It could include operation overloads, comparison, and other things that you would want to do with it. Probably a struct or typedef would do to simply keep the values. Hope this helps. Cheers. C.
17th Aug 2019, 7:25 AM
ChrA
ChrA - avatar