谢谢

解决方案 »

  1.   

    怎么msdn那么好得东西不用。。rand
    Generates a pseudorandom number.
    Routine Required Header 
    rand      <stdlib.h> 
      

  2.   

    #include <stdlib.h>
    #include <stdio.h>
    #include <time.h>msdn:记得使用前要先调用srand
    void main( void )
    {
       int i;   /* Seed the random-number generator with current time so that
        * the numbers will be different every time we run.
        */
       srand( (unsigned)time( NULL ) );   /* Display 10 numbers. */
       for( i = 0;   i < 10;i++ )
          printf( "  %6d\n", rand() );
    }