For example:
int main(void) {
Int i = Int(3); //3-bit i
You could write a wrapper class around std::bitset or std::vector. These are bit containers.
Your class would contain one of the containers and add functionality for conversion to and from integral numbers; as well as other arithmetic operations.
This will allow you to have unusual bit sized integers, such as 3, 5 and 13.
Most implementations will round up to the nearest multiple of 8 or the processor's word size. A container of 3 bits would use a uint8_t with 5 unused bits, primary because its easier for the processor to manipulate. A 13-bit integer would reside in a 16-bit package.
Edit 1: Floating Point Number
Unless you conform to the standard floating point formats, you will have to write your own wrapper class. This would allow you to have 3 bits of mantissa, 5 bits of exponent and one bit for sign -- 9bits. Again, think about all the methods you would need to write. Most applications will use either double or float because there is no need to write separate wrappers which takes coding time and testing time.