different results in visual studio and linux(eclipse) -


My code works perfectly in Visual Studio, yet I face a problem running it in eclipse . In Function:

  City * GPS :: SearchCt (Const four * city) {if (city! = NULL) {city * tmp = NULL; If (! M_gpsCities.empty ()) {for (list> City *>: iterator iter = m_gpsCities.begin (); iter! = M_gpsCities.end (); iter ++) {tmp = (city *) (* Iter); If (Vehicle :: String Compar (TMP-> GETITIUM (), city) == 0) Return TMP; }}} Return tap; }  

The problem is, after the first iteration, and when there are more 1 elements in this list, it exits from the loop, and does not move to other elements in the list.

stringcompare:

  int vehicle :: string compar (const char * str1, const char * str 2) // all tap (string s1, s2; Char * st1 = OrgName (str1), * st2 = OrgName (str2); s1.assign (st1); s2.assign (ST2); int size1 = s1.size (), size2 = s2.size (), min = 0, index = 0; if (str1 [size1 - 1] == '\ r' || str1 [size 1 - 1] == '\ 0' || str1 [size1 - 1] == '\ n' ) Size 1--; (str2 [size2 - 1] == '\ r' || str2 [size2 - 1] == '\ 0' || str2 [size2 - 1] == '\ n') Size 2--; if (size 1> size 2) min = size2; and minute = size 1; bigger big 1 = true; (index = 0; index & lt; min; index ++) {if (st1 [ Index]> st2 [index]) Return to 1; If (State 1 [Index]  

You just want to get it for your specific meaning, which is actually a type of strcmp with less specific integer output: try

  city * GPS :: SearchCity (Constrate * MySitim) {if ((MyCityName! = NULL) & amp; (! M_gpsCities.empty ()) {for (list & amp; lt; city *> gt; const_iterator iter = m_gpsCities.begin (); iter! = M_gpsCities.end (); ++ iter) {const char * MyCityTempNameChar = Iter- & gt; GetCityName (); Const char * st1 = OrgName if (negative == 0) {return (* eater);}}} return tap;}   / pre> 

or optimize the payment as follows:

  Int Vehicle :: String Compar (Const Chour * Straw, Const char * St 2) {const char * st1 = OrgName (str1), Const char * st2 = OrgName (str2); Const int predicate = strcmp (st1, st2); Return idea;}  

Comments