[問題] wxwidgets寫亂數
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
wxDevc++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
想寫亂數
但用C++的寫法似乎行不通
compiler一直不認得srand
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
expected constructor, destructor, or type conversion before '(' token
(在srand(time(NULL));這行
程式碼(Code):(請善用置底文網頁, 記得排版)
亂數部分
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
srand(time(NULL));
int randomnumber = rand()%n+1;
補充說明(Supplement):
老師只在講義上寫了randomize()就和rand()就沒了
如果要使用randomize應該include什麼才對??
或是 wxwidgets的亂數該怎麼寫@@?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.178.18
→
10/14 04:26, , 1F
10/14 04:26, 1F
有試過 但一樣無法
一樣會顯示expected constructor, destructor, or type conversion before '(' token
→
10/14 04:47, , 2F
10/14 04:47, 2F
呃...因為扣掉srand(time(NULL))compile會過程式執行也沒問題
→
10/14 04:56, , 3F
10/14 04:56, 3F
line和column是..?
※ 編輯: Ladieux 來自: 140.113.178.18 (10/14 08:06)
→
10/14 08:07, , 4F
10/14 08:07, 4F
→
10/15 08:56, , 5F
10/15 08:56, 5F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章