2014-12-11 44 views
-1

,我在下面的代碼得到48行錯誤:宣言錯誤在我的代碼

#include <graphics.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <dos.h> 
#include <conio.h> 

void swap(int a,int b);void bar1();void bar2(); 
void bar3(); void bar4(); check0(); check1(); 
check2(); void del(); void rod1(); void rod2(); 
void box1();void box2();void tee1();voidtee2(); 
void tee3();void tee4();check3();void insert(); 
void again();void print();void myremove();void frame(); 
int score=0,spd,q,t,a=0,i,j,l[6]={300,90,315,105,301,91},p,turn,m,n; 
char play='y'; 
static int arr[26][13]; 
void main(void) 
{ 

    char ch,y; 
    int gd= DETECT,gm,area,maxx,maxy,move,lmove,rmove; 
    void *buff; 
    initgraph(&gd,&gm,"d:\tc\bgi"); 
do{ 

    turn=1; 
    score=0; 
    do{ 
    clrscr(); 
    cleardevice(); 
    printf(" Enter Your Choice"); 
    printf(" Basic Level.......... 1"); 
    printf(" Middle Level......... 2"); 
    printf(" Advanced Level....... 3"); 
    printf(" Experts Level........ 4"); 
    printf(" Professional Level... 5"); 
    y=getch(); 
    clrscr(); 
    cleardevice(); 
    if(y=='1') {spd=200; settextstyle(2,0,6);outtextxy(2,150," BasicLevel ");break;} 
    if(y=='2') {spd=150; settextstyle(2,0,6);outtextxy(2,150," MiddleLevel ");break;} 
    if(y=='3') {spd=100; settextstyle(2,0,6);outtextxy(2,150," AdvancedLevel ");break;} 
    if(y=='4') {spd=75; settextstyle(2,0,6);outtextxy(2,150," ExpertsLevel ");break;} 
    if(y=='5') {spd=50; settextstyle(2,0,6);outtextxy(2,150,"ProfessionalLevel ");break;} 
     }while(1); 

    frame(); 
    getch(); 
int k,ar[2],pr[2],t[6]; 

randomize(); 
ar[0]=random(2); 
pr[0]=random(6); 
ar[1]=random(2); 
pr[1]=random(6); 
while(1) 
{ 
printf(" score= %d",score); 
a=ar[0]; 
p=pr[0]; 
l[0]=450;l[1]=250;l[2]=465;l[3]=265;l[4]=451;l[5]=251; 

if(y=='1') spd=100; 
if(y=='2') spd=75; 
if(y=='3') spd=50; 
if(y=='4') spd=30; 
if(y=='5') spd=20; 
print(); 

delay(500); 
a=ar[1]; 
p=pr[1]; 

t[0]=l[0]; t[1]=l[1]; t[2]=l[2]; 
t[3]=l[3]; t[4]=l[4]; t[5]=l[5]; 

a=ar[1]; 
p=pr[1]; 

l[0]=270;l[1]=90;l[2]=285;l[3]=105;l[4]=271;l[5]=91; 

它看起來像有殘培後出了問題()。整個源代碼是在這裏:http://codepad.org/I1cQQxJE

謝謝你的任何提示您可以提供,以幫助解決錯誤

+1

我們是否真的需要查看所有的代碼?請減少您擁有的代碼量。另外,在做這件事的時候,你很可能會更接近找到自己的答案......還有哪一行是第48行? – 2014-12-11 02:26:49

+0

什麼是錯誤?你可以說得更詳細點嗎?任何錯誤消息或...? – SSC 2014-12-11 02:28:43

回答

1

48號線:

int k,ar[2],pr[2],t[6]; 

所以我懷疑你使用的是預-C99編譯器(古老的使用conio.h就證明了這一點,儘管有更多現代和同樣便宜的選項,例如gcc),一些大學的人仍然喜歡使用20歲,過時的Borland C.

如果是這樣,您需要在塊頂部聲明變量。

+0

大聲笑看起來像所有的大師已經通過相同的老隧道。謝謝。 – CuriousDev 2014-12-11 02:35:51