Annotation of froggix/images/working/scoreTest.c, revision 1.2
1.1 nick 1: #include <stdio.h>
2: #include <stdlib.h>
3:
4: int main( void ) {
5: int score = 4560;
6: char numstr[5];
7: int i;
1.2 ! nick 8: int rn;
1.1 nick 9:
10: sprintf( numstr, "%05i", score );
11:
12: printf( "Score : %i\nString: %s\n", score, numstr );
13:
14: printf( "%c:%c:%c\n", numstr[0], numstr[2], numstr[5] );
15:
16: for ( i = 0; i <= 5; i++ ) {
17: char c = numstr[i];
18: int n = atoi( &c );
19:
20: printf( "%d:", n );
21: }
22: printf( "\n" );
23:
1.2 ! nick 24: srand(1);
! 25:
! 26: printf( "Random Number: %i\n", rand() % 128 );
! 27: printf( "Random Number: %i\n", rand() );
! 28: printf( "Random Number: %i\n", rand() );
! 29: printf( "Random Number: %i\n", rand() );
! 30:
1.1 nick 31: return 0;
32: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>