2014-12-11 67 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