怎樣用c語言使學號隨機生成
最佳回答:
#includeiostream#includestdlib.h#includetime.husingnamespacestd;intmain(void){inti;/*Seedtherandom-numbergeneratorwithcurrenttimesothat*thenumberswillbedifferenteverytimewerun.*/srand((unsigned)time(NULL));/*Display10numbers.*/for(i=0;i10;i++)printf(%6d\n,rand()%100);//100之內的隨機數}
查看更多答案>>