0

How do i check a user inputted variable's type? Like double, integer or char?

9th Aug 2018, 6:19 AM
Oğuz GözlĂŒ
Oğuz GözlĂŒ - avatar
2 Answers
0
I think i explained the question a little wrong. I am making a calculator that calculates numbers until the user inputs -1 as a number. My calculation has a switch case loop which checks thw user inputted chars like +, -, *, / and %. When i declare the varibles as integers the code works just fine, but when i change integer to double or float i have an error about the char '%'. So i want to check if user enters a double or an integer. Then i can seperate the code and if user enters doubles i wont include the '%' case to my loop. Atleast thats what im trying to do. 😓
9th Aug 2018, 10:32 PM
Oğuz GözlĂŒ
Oğuz GözlĂŒ - avatar