Question: Basic C++ Practice Question Write a program that asks the user to enter either a number or a string and then determines which type was
Basic C++ Practice Question
Write a program that asks the user to enter either a number or a string and then determines which type was entered. The program must use either cin.peek() or cin.putback() or both. The program should output "You entered this number: " or "You entered this string: " followed by the user's input. Examples:
Enter either a number or a string > 127 You entered this number: 127
Enter either a number or a string > Hello, how goes it? You entered this string: Hello, how goes it?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
