All pastes #525599 Raw Edit

Miscellany

public cpp v1 · immutable
#525599 ·published 2007-05-31 12:52 UTC
rendered paste body
#include <allegro.h>void init();void deinit();void rysujwykres();int main() {    int rozmiar = 100 ;double tablica[100];int cos=1 ;for(int i=0;i<rozmiar;i++){tablica[i]=cos ;if(i==50) cos=0;}float deltax=0.2 / 100.0 ;    float deltat=0.01 ;//int czas = 100 ;double de = 1.0e-12 ;int color2= 000 ;   //czarny                	init();for(double i=1;i<rozmiar;i=i+deltat) {tablica[0]=tablica[1];tablica[rozmiar]=tablica[rozmiar-1];for(int j=1;j<rozmiar-10;j++){ tablica[j]= de * deltat *((tablica[j+1]-2*tablica[j]+tablica[j-1])/(2*(deltax)*(deltax))) + tablica[j];      }        }	while (!key[KEY_ENTER]) {		/* put your code here */rysujwykres();  float ab, bb ;int a, b;for(int i=1;i<rozmiar;i++){ab= (float) (tablica[i-1] / 1) * 100 ;        bb= (float) (tablica[i] / 1) * 100 ;  a = (int) ab;b = (int) bb;line(screen, 50+5*(i-1), SCREEN_H-50-((a*3)+1), 50+5*i, SCREEN_H-50-((b*3)+1), color2) ;       }		      }	deinit();	return 0;}END_OF_MAIN()void init() {	int depth, res;	allegro_init();	depth = desktop_color_depth();	if (depth == 0) depth = 32;	set_color_depth(depth);	res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);	if (res != 0) {		allegro_message(allegro_error);		exit(-1);	}	install_timer();	install_keyboard();	install_mouse();clear_to_color( screen, makecol( 255, 255, 255));	/* add other initializations here */}void deinit() {	clear_keybuf();	/* add other deinitializations here */}void rysujwykres() {     int color=000;textout_ex( screen, font, "Drugie Prawo Ficka", 10, 10, makecol( 0, 0, 0), makecol( 255, 255, 255) );line(screen, 50, 50, 50, SCREEN_H-50, color);     triangle(screen, 50, 50, 50-10, 50+20, 50+10, 50+20, color);line(screen, 50, SCREEN_H-50, SCREEN_W-50, SCREEN_H-50, color);   triangle(screen, SCREEN_W-50, SCREEN_H-50, SCREEN_W-70, SCREEN_H-50-10,SCREEN_W-70, SCREEN_H-50+10, color);     }