program wyszukuje w stringu "utl1" jedno lub dwuliterowe fragmenty i porównuje ze stringiem "wyb". jeżeli łańcuchy są takie same, do stringa "pob" wpisuje napis "1", zaś jeżeli są różne, napis "0". jak widzimy, zawartość stringa "wyb" (czyli "K") jest taka sama jak jeden z fragmentów stringa "utl1". niestety program za każdym razem wyświetla napis "0". co tu jest źle?
tak wygląda mój problem:
int y=0 , x=0 ;
string utl, utl1, pob, wyb ;
wyb = "K";
utl1 = "H*Li*K*Na*Rb#" ;
while( y != utl1.length() )
{
utl = utl1[y] ;
if( utl1[y+1] != 42 )
{
utl += utl1[y+1] ;
y = y + 3 ;
}
else
y = y + 2 ;
cout << utl << endl ;
if( utl == wyb )
pob[x] = 49 ;
else
pob[x] = 48 ;
}
cout << pob[x] << endl ;