string s =
"2631:3000:3292 :3610:3800:4333 :5294:5698:6000 :6398x3:7906:15 000:16666x2:186 15:20000"
I need to split it, make ints and get the median of the numbers.
Ideal first step is to count instances of ":"
for (a = 0; a != s.length(); ++a)
{
if (s[i] = ":") cout << a << endl;
}
Error: error C2440: '=' : cannot convert from 'const char [2]' to
'char
So my questions are - is this the best way to count elements on a
string and what is the correct incantation for s[i] where i refers to
the position int he string s?
"2631:3000:3292 :3610:3800:4333 :5294:5698:6000 :6398x3:7906:15 000:16666x2:186 15:20000"
I need to split it, make ints and get the median of the numbers.
Ideal first step is to count instances of ":"
for (a = 0; a != s.length(); ++a)
{
if (s[i] = ":") cout << a << endl;
}
Error: error C2440: '=' : cannot convert from 'const char [2]' to
'char
So my questions are - is this the best way to count elements on a
string and what is the correct incantation for s[i] where i refers to
the position int he string s?
Comment