Annotation of froggix/images/working/scoreTest.c, revision 1.1
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;
! 8:
! 9: sprintf( numstr, "%05i", score );
! 10:
! 11: printf( "Score : %i\nString: %s\n", score, numstr );
! 12:
! 13: printf( "%c:%c:%c\n", numstr[0], numstr[2], numstr[5] );
! 14:
! 15: for ( i = 0; i <= 5; i++ ) {
! 16: char c = numstr[i];
! 17: int n = atoi( &c );
! 18:
! 19: printf( "%d:", n );
! 20: }
! 21: printf( "\n" );
! 22:
! 23: return 0;
! 24: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>