Hello everyone,
I am writing a text-based Scrabble implementation for a college project.
The specification states that the user's position input must be read from single line, like this:
Coordinates of the word's first letter and orientation (<A – P> <1 – 15> <H ou V>): G 5 H
G 5 H
is the user's input for that particular example. The order, as shown, must be char
int
char
.
What is the best way to read the user's input?
cin >> row >> column >> orientation
will cause crashes if the user screws up.
A getline
and a subsequent string
parser are a valid solution, but represent a bit of work.
Is there another, better, way to do this, that I am missing?
Thanks for your time!