作者steve1012 (steve)
看板NTUBIME103HW
标题[C++ ] 考古题
时间Sun Jan 9 16:28:45 2011
最後一题
程式码如下
#include "stdafx.h"
#include "iostream"
#include <time.h>
using namespace std;
int _tmain(int argc, _TCHAR*argv[])
{
srand(time(NULL));
int X=0, Y=0;
for(int i = 0 ; i < 1000 ; i++)
(rand()%2) ? X++ : Y++;
cout<< X <<" "<<Y <<endl;
return 0;
}
後面的我继续补
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.34.202.142
1F:推 stan999950:亲一个> ..^ 01/09 16:47
2F:推 kn930121:维峻又大神了 01/09 17:21
3F:推 ss355227:我想知道全部的答案> < 维峻当个英雄吧 01/09 21:43
4F:推 hankhank:谢啦!! 01/10 23:20