2015年4月23日
摘要: 产生一定范围随机数的通用表示公式要取得[a,b)的随机整数,使用(rand() % (b-a))+ a;要取得[a,b]的随机整数,使用(rand() % (b-a+1))+ a;要取得(a,b]的随机整数,使用(rand() % (b-a))+ a + 1;通用公式:a + rand() % n;... 阅读全文
posted @ 2015-04-23 20:37 三人纷纷 阅读(384) 评论(0) 推荐(0) 编辑
摘要: double a=3; //一定是double不能是intcout.setf(ios::fixed); cout.precision(2);cout<<a<<endl;输出:3.00 阅读全文
posted @ 2015-04-23 19:23 三人纷纷 阅读(1230) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;int sum;int store[10];void OutPut(){ for(int i=9;i>=0;i--) { cout(num+1)*10) //num从0到9 return; if(num==0) { stor... 阅读全文
posted @ 2015-04-23 17:01 三人纷纷 阅读(3842) 评论(0) 推荐(0) 编辑