2014-10-09 52 views
-3

IM學習C語言編程,我不knonw什麼用此程序腳麻錯誤:無效的數字「8」在八進制常量

在構建信息錯誤代碼是

錯誤:無效的數字八進制常數中的「8」。

任何一個可以幫助請和謝謝=)

#include <stdio.h> 
#include <stdlib.h> 

int ch ; 
int codeS , codeH; 
int ph = 1 , ad = 2 , lb = 3 , us = 4; 

int main() 

{ 

    //int ch ; 

    printf("\n Bienvenue à SHCPahrma \n Veulleiz Choisir Votre Code Section \n ph : 1\t ad : 2\t lb : 3\t us : 4\t\n num secteur "); 
    scanf("%d",&ch); 
    printf("\n Entrer votre code secteur \t = "); 
    scanf("%d",&codeS); 
    printf("\n Entrer Code Horaire \t = "); 
    scanf("%d",&codeH); 




    // ch = 1223 ; 
    //printf("%d",ch); 
    if ((ch == 1) && (codeS == 1111) && (codeH == 0815)) 
    { 
     printf("Bienvenue Mr le Pharmacien\n"); 
    } 
    else if ((ch == 2) && (codeS == 2222) && (codeH == 0815)) 
    { 
     printf("Bienvenue Mr l'Administrative\n"); 
    } 
    else if ((ch == 3) && (codeS == 3333) && (codeH == 0717)) 
    { 
     printf("Bienvenue Mr agent laboratoire\n"); 
    } 

    else if ((ch == 4) && (codeS == 3333) && (codeH == 0717)) 
    { 
     printf("Bienvenue Mr agent Usine \n"); 
    } 

    else 
    { 
     printf("Accées Interdit veullier Contacter l'administration\n") 
    } 


    return 0; 
} 
+2

在八進制數中遇到過「8」嗎? – P0W 2014-10-09 13:45:59

+0

[數組聲明有什麼錯誤:「八進制常量中的無效數字」?](http://stackoverflow.com/questions/8459030/whats-wrong-with-array-declaration-invalid-digit-in-octal -不變) – DoxyLover 2014-10-09 21:02:56

回答

5

一個組成文字開頭的0,或基礎8.這意味着它只能包含數字[0-7 ]。如果你想要一個十進制數,你必須刪除前導0

相關問題