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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!