i have a multidimensional array of character type numbers separated by X's i want to go through the array and store each group of numbers in between the X's as strings but i don't know how to go about this
1 2 3 4 5 6 7 8 9 10 11 12 13 14
for(i=0;i<G.getHeight();i++)
{
for(j=0;j<G.getWidth();j++)
{
if (G.at(i,j)!= 'X')
{
temp[j]=G.at(i,j);
}
if (G.at(i,j)== 'X')
break;
}//inner for
if (temp.size()>= Sizes[0] && temp.size()<=Sizes[K])
list.insert(temp);
}//outter for
temp is type string and this trips the assertion in the string class is there some way i can circumvent the assertion statement?
for(i=0;i<G.getHeight();i++)
{
for(j=0;j<G.getWidth();j++)
{
if (G.at(i,j)!= 'X')
{
temp.insert(G.at(i,j));
}
if (G.at(i,j)== 'X')
break;
}//inner for
if (temp.size()>= Sizes[0] && temp.size()<=Sizes[K])
list.insert(temp);
}//outter for
this makes much more sense to me but it is still not working i get an error called
Error 1 error C2664: 'std::_String_iterator<_Elem,_Traits,_Alloc> std::basic_string<_Elem,_Traits,_Ax>::insert(std::_String_const_iterator<_Elem,_Traits,_Alloc>)' : cannot convert parameter 1 from 'char' to 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' c:\users\tyler\documents\visual studio 2010\projects\cs150_program_3\cs150_program_3\grid_driver.cpp 119 1 cs150_Program_3