Question: C++ Programming question Problem 2: Write a function that converts a string into an integer. For example, given the string 1234, the function should return
Problem 2: Write a function that converts a string into an integer. For example, given the string 1234", the function should return the integer 1234. You should write your own code to do the conversion (you may NOT use atoi function or the stringstream class). Write a main method to ask the user to enter a string and then outputs the resulting integer For testing purposes, all test cases will have two outputs: 1) the integer, 2) the integer added to 10 (this is to make sure you are doing the conversion) You may assume that the string is a valid integer. Reminder: To convert a character to a number, add 0 to the character. For example, to convert the character '0' to the number 0: char c = '0"; int number = static castint2(c)-static castint2('0')
Step by Step Solution
There are 3 Steps involved in it
To solve this problem well create a function in C that converts a string to an integer without using ... View full answer
Get step-by-step solutions from verified subject matter experts
