How to get variables to my program vrom text file [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a file like:
a [able%5:00:00:capable:00] [able] capable
a [abnormal%3:00:00::] [abnormal]
a [absent%3:00:00::] [absent]
a [absolute%3:00:00::] [absolute] perfect or complete
a [abstract%3:00:00::] [abstract] existing only in the mind
a [abundant%3:00:00::] [abundant] plentiful
I want to get first column "avle", "abnormal" etc to my object. How to crop them and how storage them?

Use the string tokenizer, the best/easiest way to split a line into different variables.
char* word = strtok(line," [%:]");
char* word2 = strtok(0," [%:]");
int value = strtoi(strtok(0," [%:]"));
to store there is a vector container, but there can be used any type of arrays, what is more convenient

Related

Taking input using delimiter in C++ [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
After taking those values I have to store the values in two different arrays (say x and y)
So the only error I can immediately see is this
float* a = NULL;
a = new(nothrow)float;
which should be
float* a = new float[count];
Your version only allocates enough space for a single float when you really need space for count floats.
When you have code that isn't working, and you want to ask a question about it you really should say exactly what happens when you run the code. Doing this will help get you better answers.

Split a string in UIPath using regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a string stored in a variable - "Input_value:123_Output".
I want to split this string with underscore(_) and Double colon(:). So that the indexing of my output string will be like this : [0]-Input, [1]-value, [2]-123, [3]-Output.
Thanks!
Try splitting on the regex character class [:-]. This would split on either a colon or an underscore, which is the behavior you want.
In addition to [:-] looking like a smiley face, it is also very compact and easy to read.

Most efficient way of ignoring spacing on c++? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
If I have two strings:
string str1 = "Something about the way that you walked into my living room";
string str2 = "Something about the way that you walked into my living room";
How do I write a function to return that these two strings are the same thing?
Firstly, you can replace multiple consecutive spaces with single space as given here
Replace multiple spaces with one space in a string
Then compare the strings

I need a regex for the following combination [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
mission_id: a498094578a
mission_id: a493453456
mission_id: 498343454a
mission_id: 34534535345
From the above 4 mission_id's I need your help in writing a regex pattern which covers all the four mission_id but need to select only the numbers.
So one the first one - need to exempt 'a' and only the numbers.
mission_id:\s*\w?(\d*)\w?
That should work; maybe add any flags you need for parsing multiline text or whatever.
www.regexr.com is a great resource for trying out RegExps

Turning a string that contains a equation into an integer [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to be able to convert a string such as "(5+6)*6" and get the resulting integer from that equation. It is important that it starts out as a string.
You can use library fastmathparser for c++.
In link is example how use this library.
If you really want write alone this parser, I recomended use Shunting-yard algorithm