[問題] 簡單的洗牌程式..
#include<stdio.h>
#include<stdlib.h>
main()
{
int i,j;
int temp ;
for(i=1;i<52;i++)
{
do
{
j=rand()%52 ;
}
while(i==j) ;
temp=game[j].flower ;
game[j].flower=game[i].flower ;
game[i].flower=temp ;
temp=game[j].number ;
game[j] .number=game[i].number ;
game[i].number=temp ;
}
system("pause");
}
這是前面文章有人寫到的,我拿來練習一下
可是有發生個錯誤
他說`game' undeclared (first use this function)
這該怎麼除錯呢,煩請賜教^^
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.231.249.224
→
02/09 10:04, , 1F
02/09 10:04, 1F
→
02/09 10:25, , 2F
02/09 10:25, 2F
推
02/09 11:08, , 3F
02/09 11:08, 3F
→
02/09 12:11, , 4F
02/09 12:11, 4F
推
02/09 12:41, , 5F
02/09 12:41, 5F
推
02/09 15:06, , 6F
02/09 15:06, 6F
推
02/09 17:18, , 7F
02/09 17:18, 7F
推
02/09 20:43, , 8F
02/09 20:43, 8F
→
02/09 21:18, , 9F
02/09 21:18, 9F
推
02/09 21:30, , 10F
02/09 21:30, 10F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章