Lets say that input from the user is a decimal number, ex. 5.2155 (having 4 decimal digits). It can be stored freely (int,double) etc.
Is there any
Something like this might work as well:
float i = 5.2154; std::string s; std::string t; std::stringstream out; out << i; s = out.str(); t = s.substr(s.find(".")+1); cout<<"number of decimal places: " << t.length();