2013-07-22 2 views
-7

이 C 코드의 문제점을 이해하지 못합니다. 나는 이것을 학습 목적으로 요구하고있다. 나는 게임이 어리석은 것을 알고있다. 그러나 그것은 단지 재미와 학습을위한 것이다. 이 코드의 문제점은 무엇입니까?

#include <stdio.h> 
int main(){ 
    int response 
    char name [20]; 
     printf ("Welcome to Game1\n"); 
     printf ("What's your name?\n"); 
     scanf ("%s",name); 
     printf ("From now on you're Private %s\n",name); 
     printf ("Loading...\n"); 
     delay(4000); 
     printf("You are in a army excersize yard.\n"); 
     delay(4000); 
     printf("Your sargeant approaches.\n"); 
     printf ("Sargeant Sam: Drop and give me twenty, Private %s\n",name); 
     printf ("1) Yessir!\n2)Make me\n"); 
     scanf ("%d\n", response); 
      if(response==1){ 
       printf ("You do 20 pushups\n"); 
      } 
      if(response==2){ 
      printf("Sargeant Sam: What did you say?!\n"); 
      } 
return (0); 
} 

내가 그렇게 간단하게 모든 것을 설명하시기 바랍니다 완전한 초보자 오전 오류
game1.c: In function ‘main’: 
game1.c:4: error: nested functions are disabled, use -fnested-functions to re-enable 
game1.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘char’ 
game1.c:16: error: ‘response’ undeclared (first use in this function) 
game1.c:16: error: (Each undeclared identifier is reported only once 
game1.c:16: error: for each function it appears in.) 

있습니다.

+1

사람을 그만 두지 말고 반복적으로 같은 질문을 게시하기 전에 배우려 고 노력하십시오. 예를 들어 [Question-2] (http://stackoverflow.com/questions/17793445/what-does-undefined-symbols-for-architecture-x86-64-mean-in-c)를 게시하기 전에 [ qestion -2] (http://stackoverflow.com/questions/17792702/when-compiling-ac-program-i-get-this-error-hello-no-such-file-or-directory) –

답변

4
int main(){ 
int response 
      ^

여기에 세미콜론이 없습니다.

3
int response 

선언문은 세미콜론 (;)으로 끝납니다.

게다가, coherent indentationdelay은 C 표준에 속하지 않습니다 (<stdio.h>에 선언되지 않음).

+1

다른 게시물 당신을 이길 15 초 – jdero

+0

죄송합니다. 끔찍한 게시물이었습니다. (시간을 낭비하게되어서 죄송합니다. 점수가 낮아서 지금은 아무 것도 게시 할 수 없습니다. 지금은 이미 많은 것을 조사 했으므로 좋은 질문이 있습니다. – user2607534

관련 문제