Hello,
I have a problem in C++ that has been giving me a bit of problem.
I am suppose to write a program that allows a user to enter a sentence, and then ask for two positions from the user, and then switch around the sentence according to the positions entered.
If the user enters a negative number as a position to switch; the program should end.
If the user enters a number less than one, or greater than the number of words in the sentence, the following should print "Invalid position entered"
and ask for the first position again.
For example a user typed "The cat sat on mat the"
The program would look like this:
Enter the sentence: The cat sat on mat the
Enter first position: 5
Enter second position: 6
The cat sat on the mat
Please can someone assist me as soon as possible. Thank you