In C is there a simple way to accept user input store as cin
In C++, is there a simple way to accept user input, store as cin object, and plug the input into a sizeof operator to return the size of the data type the user entered, without using any extended if-else statements? I\'m talking like, C++ 101 way to do this. I.E., you cout asking for a data type, and the program will tell you the size in bytes of an integer if the user entered int, or size in bytes of a character if they enter char. To reiterate, a simple way involving putting the input straight into the operator, not drafting a list matching all the input option with the respective sizeof operation.
Solution
#include