H
H
HappyMen2020-05-17 22:52:53
C++ / C#
HappyMen, 2020-05-17 22:52:53

How to split (tokenize) a mat expression in C++?

Hello, help me how to write a function that will separate the expression into characters and numbers.

I entered x= 2*x+(s/5)
The program gave me: "x", "2", '*', "x", '+ ', "s", '/', "5"

For example:
input: x=a*(b+3)
it parses into 4 parts "x", "a", '*', "b+3"
" x", "a", '*' do not touch further, because these are already simple expressions (variables or numbers, action signs separately)
"b + 3" we parse further recursively into "b", '+', "3"
into output - "x", "a", '*', "b", '+', "3"

Are there ready, options, functions. I feel like I can't write

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question