mercredi 29 juillet 2020

How should i "interpret" a user command in c++? [closed]

Goodmorning, i think i need some advices about a project i have to develop for a university exam. The first part of the program must be able to read a sentence entered from the user. the user must specify the name of a "table" in which he will insert records. so, for exemple, the user enters : CREATE TABLE CUSTOMERS (ID INT, NAME TEXT, AGE INT) meaning that he wants to create a table called customers: in this exemple, for every record 3 fields must be filled.

The user can enter different type of commands.

  1. he can for exemple delete a record, update a record and many others possible commands
  2. the names of the variable he enters must be single words (no spaces allowed)

My question is, should i create a sort of "dictionary", where every word is linked to a certain function and search for a "match" between the each substring and the dictionary?

which is the most efficient way to "interprete" the user sentence by using only the STL?

Aucun commentaire:

Enregistrer un commentaire