From: David Jenkins Newsgroups: comp.os.msdos.djgpp Subject: Problems with Scanf in Allegro.WAS -Problems with palette. Date: Fri, 21 Feb 1997 03:26:53 +0000 Organization: None Distribution: world Message-ID: References: NNTP-Posting-Host: jenkinsdavid.demon.co.uk MIME-Version: 1.0 Lines: 70 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article , David Jenkins writes #include #include #include void main() { /* If I un // the next two lines and // the "int ns = 100;" line I should be able to enter the number of stars.BUT I keep getting errors during compiling.Any ideas??? */ // printf("How many stars shall I use???"); // scanf("%d", ns); int ns = 100; int d = 1; int o = 1; int x[ns]; int y[ns]; int sp[ns]; PALLETE pal; for (d = 1; d < 4; d++) { pal[d].r = d*20; pal[d].g = d*20; pal[d].b = d*20; } allegro_init(); set_gfx_mode(GFX_VGA, 320, 200, 0, 0); set_pallete(pal); install_keyboard(); for (d = 0; d < ns; d++) { x[d] = rand() % SCREEN_W; y[d] = rand() % SCREEN_H; sp[d] = rand() % 3 + 1; } while (!keypressed()) { for (d = 1; d < ns; d++) { x[d] = x[d] - sp[d]; if (x[d] <= 0) x[d] = SCREEN_W; putpixel(screen, x[d], y[d], sp[d]); } vsync(); clear(screen); } exit(0); } -- David Jenkins