Code::Blocks i polskie znaki w windowsowskiej konsoli
Kod: Zaznacz cały
string pl(string znak)
{
for( unsigned i = 0; i < znak.length(); i++ ) {
switch( znak[ i ] ) {
case 'ą':
znak[ i ] = static_cast < char >( 165 );
break;
case 'ć':
znak[ i ] = static_cast < char >( 134 );
break;
case 'ę':
znak[ i ] = static_cast < char >( 169 );
break;
case 'ł':
znak[ i ] = static_cast < char >( 136 );
break;
case 'ń':
znak[ i ] = static_cast < char >( 228 );
break;
case 'ó':
znak[ i ] = static_cast < char >( 162 );
break;
case 'ś':
znak[ i ] = static_cast < char >( 152 );
break;
case 'ź':
znak[ i ] = static_cast < char >( 171 );
break;
case 'ż':
znak[ i ] = static_cast < char >( 190 );
break;
case 'Ą':
znak[ i ] = static_cast < char >( 164 );
break;
case 'Ć':
znak[ i ] = static_cast < char >( 143 );
break;
case 'Ę':
znak[ i ] = static_cast < char >( 168 );
break;
case 'Ł':
znak[ i ] = static_cast < char >( 157 );
break;
case 'Ń':
znak[ i ] = static_cast < char >( 227 );
break;
case 'Ó':
znak[ i ] = static_cast < char >( 224 );
break;
case 'Ś':
znak[ i ] = static_cast < char >( 151 );
break;
case 'Ź':
znak[ i ] = static_cast < char >( 141 );
break;
case 'Ż':
znak[ i ] = static_cast < char >( 189 );
break;
}
}
return znak;
}