DarkFable
10-27-05, 18:07
Ok tomorrow i have a C++ test in my grade 11 computer science course and my teacher gave us a few questions to practise at home (I'm using Visual C++ from Visual Studio 6.0 Enterprise). Heres the problem:
Problem 1. Have the user input a 4-digit character array or string. Have your program convert this string into an integer value without using the atoi function.
As it clearly states, i cannot use the atoi function. Now a previous question wanted the opposite (integer to char array) with itoa function and i got that working with the code i have in the txt file.
Problem 2. Have the user guess at random number. Have the computer tell the user either “Higher” or “Lower” until correct. The program will show the total number of guesses. Also, if the user is a moron, tell them so. For example, assume the correct number is 12. If the user inputs 7 and your program informs the user “higher”, if at any later time the user inputs a number of 7 or lower, the program is permitted to call the user a “moron”.
My question is if someone can please code this for me because i have missed that last 4 days of school with the flu and am i little behind. Also, if you could code it at a similar level as the code in the txt file, i would really appriciate it because thats how far our class as gotten so far. Please refer to the text file.
Thanks in advance,
Marko
Problem 1. Have the user input a 4-digit character array or string. Have your program convert this string into an integer value without using the atoi function.
As it clearly states, i cannot use the atoi function. Now a previous question wanted the opposite (integer to char array) with itoa function and i got that working with the code i have in the txt file.
Problem 2. Have the user guess at random number. Have the computer tell the user either “Higher” or “Lower” until correct. The program will show the total number of guesses. Also, if the user is a moron, tell them so. For example, assume the correct number is 12. If the user inputs 7 and your program informs the user “higher”, if at any later time the user inputs a number of 7 or lower, the program is permitted to call the user a “moron”.
My question is if someone can please code this for me because i have missed that last 4 days of school with the flu and am i little behind. Also, if you could code it at a similar level as the code in the txt file, i would really appriciate it because thats how far our class as gotten so far. Please refer to the text file.
Thanks in advance,
Marko