File:  [Local Repository] / froggix / images / working / scoreTest.c
Revision 1.2: download - view: text, annotated - select for diffs
Tue Apr 7 03:51:53 2009 UTC (15 years, 8 months ago) by nick
Branches: MAIN
CVS tags: HEAD
Added the bonus fly graphic and code.
Note: The random generation for the location in the goals is poor and quite
predictable.  This will need to ne fixed.

#include <stdio.h>
#include <stdlib.h>

int main( void ) {
	int score = 4560;
	char numstr[5];
	int i;
	int rn;

	sprintf( numstr, "%05i", score );

	printf( "Score : %i\nString: %s\n", score, numstr );

	printf( "%c:%c:%c\n", numstr[0], numstr[2], numstr[5] );

	for ( i = 0; i <= 5; i++ ) {
		char c = numstr[i];
		int n = atoi( &c );

		printf( "%d:", n );
	}
	printf( "\n" );

	srand(1);

	printf( "Random Number: %i\n", rand() % 128 );
	printf( "Random Number: %i\n", rand() );
	printf( "Random Number: %i\n", rand() );
	printf( "Random Number: %i\n", rand() );

	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>