- 380 名前:デフォルトの名無しさん mailto:sage [2010/03/15(月) 21:58:35 ]
- >>338
#include <stdio.h> #include <stdlib.h> void main(int argc, char** argv ) { char str[0xFF]; double n[1000]; int n_max = 0; int i=0; FILE* fp = fopen( argv[1], "r"); while( fgets(str,0xFF-1,fp) != NULL ){ n[n_max++]=strtod( str, NULL ); } srand((unsigned)(time(NULL))); while( i < 5 ) { int r = rand()%n_max; if( n[r] != 1e+306 ) { printf( "%f\n", n[r] ); n[r]=1e+306; i++; }} } くじびき的な何か?
|

|