Name: _____________________________ Honor Code Acknowledgment: ________________________ Random Quiz # 10 CPS 08, Spring 1995 March 3, 1995 Problem 1: Acch, ptooey The function atoi in converts a string to an integer. However, the value of atoi("dog") is 0. Suppose that you don't have access to so that you must write your own version of atoi. Do this using the header below. The function doesn't have to work with negative numbers, but you get extra credit if it does. The intOk parameter is set to true if the string passed is a valid integer (all digits) and is set to false if the string is NOT a valid integer. Thus atoi("123",x,y) should result in x getting the value 123 and y getting the value true; whereas atoi("12a3",z,w) should result in w getting the value false (the value of z in this case can be anything). void atoi(String s,int & value, bool & intOK) // postcondition: value = integer represented by string s // intOk = true if s represents a valid integer // otherwise intOk = false