New course! Every coder should learn Generative AI!
Try a free lesson+ 1
You can either use a float or a double to store floating point values:
https://www.sololearn.com/learn/CPlusPlus/1622/
For support of rational arithmetic at compile time, there is also the <ratio> header in the STL:
https://en.cppreference.com/w/cpp/numeric/ratio