2014-01-30 129 views
-1

這是我的代碼:錯誤預期表達「)」標記和C錯誤 - 錯誤:之前預期的表達式「]」令牌

#include <stdio.h> 
#include <conio.h> 
#define MAX 10; 

int rradhe[MAX]; 
int koka = -1; 
int bishti = -1; 

void shto_djathas() 
{ 
int element; 

if ((koka == 0 && bishti == MAX -1)||koka == bishti +1) 
{ 
    printf("\nGjendje Overflow"); 
    getch();int rradhe[MAX]; 
int koka = -1; 
int bishti = -1; 
    return; 
} 
if (koka == -1) 
{ 
    koka = 0; 
    bishti = 0; 
} 
else 
    if (koka == MAX -1) 
    bishti = 0; 
else 
    bishti = bishti + 1; 
    printf ("\n Shtypni elementin qe doni te shtoni "); 
    scanf ("%d", &element); 
} 

void main() { 
    int c; 
while(1){ 
printf("---------------------------"); 
printf("\nDetyre Kursi - Ivi Hysenbelli , Olsi Lala"); 
printf("\n 1 - Shtoni element ne rradhe"); // elementet do te shtohen nga e djatha 
printf("\n 2 - Hiq element nga e djatha(Nga fillimi)"); 
printf("\n 3 - Hiq element nga e majta(Nga fundi)"); 
printf("\n 4 - Afisho rradhen"); 
scanf("%d",&c); 
switch (c) { 

case 1: 
    shto_djathas(); 
    break; 



} 

} 
} 

我不能得到爲什麼我看這個錯誤。

錯誤代碼是行我幾乎嘗試了一切,書讀得很多論壇,但我不能明白爲什麼。 這是我第一次在c..im中創建一個新手,我會很感激你的幫助。 在此先感謝。

p.s.對不起,我的英語

+1

在寬鬆的#define MAX 10'最後的分號;'。行號是一個提示。 – usr2564301

+2

並嘗試接受一些答案。 – Dipto

回答

0

這是你修改後的代碼:

#include <stdio.h> 
#include <conio.h> 
#define MAX 10 

int rradhe[MAX]; 
int koka = -1; 
int bishti = -1; 

void shto_djathas() 
{ 
int element; 

if ((koka == 0 && bishti == MAX -1)||koka == bishti +1) 
{ 
    printf("\nGjendje Overflow"); 
    getch();int rradhe[MAX]; 
int koka = -1; 
int bishti = -1; 
    return; 
} 
if (koka == -1) 
{ 
    koka = 0; 
    bishti = 0; 
} 
else 
    if (koka == MAX -1) 
    bishti = 0; 
else 
    bishti = bishti + 1; 
    printf ("\n Shtypni elementin qe doni te shtoni "); 
    scanf ("%d", &element); 
} 

int main() { 

    int c; 
    while(true){ 
     printf("---------------------------"); 
     printf("\nDetyre Kursi - Ivi Hysenbelli , Olsi Lala"); 
     printf("\n 1 - Shtoni element ne rradhe"); // elementet do te shtohen nga e djatha 
     printf("\n 2 - Hiq element nga e djatha(Nga fillimi)"); 
     printf("\n 3 - Hiq element nga e majta(Nga fundi)"); 
     printf("\n 4 - Afisho rradhen"); 
     scanf("%d",&c); 

     if (c == 1) 
      shto_djathas(); 
    } 
    return 0; 
} 
相關問題