CodePudding user response:
For example:12.03, 515.04, 117.9, 52.79, 13.58
18.03, 415.04, 217.9, 42.79, 23.58
11.03, 315.04, 317.9, 32.79, 33.58
1.03, 215.04, 417.9, 22.79, 43.58
32.03, 115.04, 517.9, 12.79, 53.58
CodePudding user response:
Can't doHow many columns must be explicitly
Rows can not directly determine instead
CodePudding user response:
# include & lt; Iostream>
#include
#include
#include
#include
using namespace std;
VectorSplitString (const char * STR, char token)
{
VectorThe result;
Const char * p=STRCHR (STR, token);
Const char * start=STR;
While (p!=nullptr)
{
Size_t size=p - start;
Char * TMP=new char [size + 1];
TMP [size]='\ 0';
Memcpy (TMP, start, size);
Result. The push_back (string (TMP));
The delete [] TMP;
p++;
Start=p;
P=STRCHR (p, token);
}
Result. The push_back (string (start));
return result;
}
Int main () {
Char STR []=1.2, 1.3, 1.4, "";
VectorArr=splitString (STR, ', ');
STD: : for_each (arr. The begin (), arr. The end (), [] (const string& N) {cout & lt;return 0;
}
CodePudding user response:
The most simple way to find a CSV libraryCodePudding user response:
Part of the code to borrow 3 floor save trouble, just reply to a reading of the text, modified directly, even don't know any ranks it doesn't matter, is behind the data should have a comma,CodePudding user response:
Reply didn't notice the request is quite good, existing in a two-dimensional arrayNow save the data string and the two-dimensional array has nothing to do
If only read the data output
That's too simple
CodePudding user response: