爱嘉牛LA

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年4月26日

摘要: View Code #include <iostream> #include <stdlib.h> #include <time.h> using namespace std; int main() { int a=2,b=9; srand((unsigned)time(NULL)); for(int i=0; i<10;i++ ) cout<<rand()%(b-a)+a<<endl; cout << endl; return 0; }<一>生成[a,b)的随机整数,使用rand()%(... 阅读全文
posted @ 2012-04-26 19:33 爱嘉牛LA 阅读(570) 评论(0) 推荐(1) 编辑