标题: 这种程序应该怎样写?
时间: 2013-10-12
『回复列表(17|隐藏机器人聊天)』
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main( void ){
int i, t, c = 0;
float s = .0;
srand( (unsigned)time( NULL ) );
for( i = 0; i < 10000; i++ ){
t = rand() % 100;
printf( " %d\n", t );
if( t < 10 ) c++;
}
s = (float)c / 10000;
printf( "%f\n", s );
return 0;
}