I\'m writing a project that we do simple calculator from command line. The users input in this format programname firstNumber operator secondNumber. Here what I
atoi converts a string to an int, so 2.5 will be converted to 2 and 1.25 will be converted to 1, that's why you get the result 2 + 1 = 3. Use atof instead.