string as a constrain(?)

hi, i have a rectangle problem, the point of the program is to ask user, to give name to the rectangle, coordinate of it and so on. my main problem is in the naming, because it has contrains by string (that's what I think, not sure).
I know how to do the next step, however, prompting this input is what holds me, and it was the first step.

here's what the problem states:

Write a function that prompts and reads from the user the name of the rectangle or the
word stop and validates this user input. The user will enter the name for a rectangle
by typing the keyword rec followed by a single space and then the name, e.g., when the
user enters rec john (this is valid input), the name of the rectangle will be assigned
to john. Note that just typing john is invalid input. If the user types stop then
this indicates that the user does not want to enter any more rectangles. This is valid
input. The user is not allowed to input a name for a rectangle that is already used for
a previously entered rectangle. This is invalid input. Any other input is also invalid.
This function has a return type of bool and returns true only if the user input entered
was valid.
The function has ve input parameters. A string that holds the prompt that asks for
the name of the rectangle. A string that holds an error message to display if the user
types invalid input. A string that holds an error message to display if the user types
a name that is already being used. A string that will pass back the user input, i.e.3. whatever the user entered. Lastly, a vector of rectangles, i.e. a list, containing all
rectangles entered so far. Use this function in steps (ii) and (xi).

and basicly, this is the template of the main

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
i. Display welcome banner
ii. WHILE user input is invalid /* Prompt and read rst rectangle's name*/
iii. Display "Try again! "
iv. IF user input is not 'stop'
v. Extract rectangle name from user input
vi. Prompt for bottom left point
vii. Prompt for length and height
viii. Add new rectangle to the rectangle list
ix. WHILE user input is not 'stop'
x. Display "Thank you! "
xi. WHILE user input is invalid /* Prompt and read next rectangle's name */
xii. Display "Try again! "
xiii. IF user input is not 'stop'
xiv. Extract rectangle name from user input
xv. Prompt for bottom left point
xvi. Prompt for length and height
xvii. Add new rectangle to the rectangle list
xviii. IF the rectangle list is not empty
xix. Display all rectangles in the rectangle list
xx. ELSE
xxi. Display that no rectangles are in the list


thanks
Topic archived. No new replies allowed.