int main()
{
int tablica[ 10 ];
srand( time( NULL ) );
for( int i = 0; i < 10; i++ ) {
tablica[ i ] = 1 + rand() % 30;
}
allegro_init();
install_keyboard();
set_color_depth( 24 );
set_gfx_mode( GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0 );
BITMAP * bufor = create_bitmap( 800, 600 );
clear_to_color( bufor, makecol( 128, 128, 128 ) );
BITMAP * pole = create_bitmap( 40, 40 );
clear_to_color( pole, makecol( 0, 128, 0 ) );
textprintf_ex( bufor, font, 0, 0, makecol( 255, 255, 255 ), - 1, "program sortujacy 10 liczb z zakresu 1-30!" );
for( int licz = 0; licz < 10; licz++ )
{
masked_blit( pole, bufor, 0, 0, licz * 45, 10, bufor->w, bufor->h );
textprintf_ex( bufor, font, 15 +( licz * 45 ), 25, makecol( 255, 255, 255 ), - 1, "%d", tablica[ licz ] );
}
quicksort( bufor, tablica, 1, 10 );
masked_blit( bufor, screen, 0, 0, 0, 0, bufor->w, bufor->h );
readkey();
destroy_bitmap( bufor );
destroy_bitmap( pole );
allegro_exit();
return 0;
}
END_OF_MAIN();