作者elle0001tw (。。。)
看板Programming
标题[问题] C语言作业的问题
时间Wed May 16 22:57:47 2007
原始程式码我放在这里
http://www.badongo.com/file/3068247
我用 Microsoft Visual C++ 6.0 compile 时 显示的错误讯如下
------------------Configuration: Array test - Win32 Debug--------------------
这部分已解决,感谢james732的热心回信 ^^
-----------------------------------------------------------------------------
另外想问的是
int response[ SIZE ] =
{ 6, 7, 8, 9, 8, 7, 8, 9, 8, 9,
7, 8, 9, 5, 9, 8, 7, 8, 7, 8,
6, 7, 8, 9, 3, 9, 8, 7, 8, 7,
7, 8, 9, 8, 9, 8, 9, 7, 8, 9,
6, 7, 8, 7, 8, 7, 9, 8, 9, 2,
7, 8, 9, 8, 9, 8, 9, 7, 5, 3,
5, 6, 7, 2, 5, 3, 9, 4, 6, 4,
7, 8, 9, 6, 8, 7, 8, 9, 7, 8,
7, 4, 4, 2, 5, 3, 8, 7, 5, 6,
4, 5, 6, 1, 6, 5, 7, 8, 7 };
如上,如果我改为 #define SIZE 21 (原本是SIZE 99)
然後想把一开始 int response[ SIZE ] = {......}中的数字
改为由系统自动产生乱数1~9。
也就是
建立一个integer type (int) 的Array,SIZE为21
Array的Elements是乱数产生的介於1~9之间的整数
的话,要怎麽改呢?
我很天真地写下...
int content;
srand(time(NULL));
content = ( rand( )%9 )+1;
int response[ SIZE ] = { content };
结果完全行不通...(可见我是超新手...)
麻烦大家了,谢谢^^
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.114.216.102
※ 编辑: elle0001tw 来自: 140.114.216.102 (05/16 23:24)
1F:推 raptorevo:有学到回圈了吗@@?得用回圈去run喔 61.217.194.222 05/17 00:59