컴퓨터 프로그래밍 2 Week 1 : 프로그래밍 개발과정

  • View
    82

  • Download
    0

Embed Size (px)

DESCRIPTION

컴퓨터 프로그래밍 2 Week 1 : 프로그래밍 개발과정. 담당교수 : 최 윤 정. 에디터 (editer). 컴파일러 (compiler). 링커 (linker). 로더 (loader). 소스파일 test.c. 오브젝트 파일 test.obj. 실행파일 test.exe. 통합 개발 환경 (IDE). 프로그램 작성 과정. 프로그램 작성 단계. 편집 (edit) 에디터를 이용하여 원하는 작업의 내용을 기술하여 소스 코드 작성 - PowerPoint PPT Presentation

Text of 컴퓨터 프로그래밍 2 Week 1 : 프로그래밍 개발과정

2-C

2 Week 1: :

1 2

test.ctest.obj

test.exe(compiler)

(linker)(loader)(editer) (IDE)

(edit) (source file): () test.c

(compile) -> (object file) : () test.obj

(link) (executable file): () test.exe3

4Q & A(Q) , ?5(A) ! , . . . Visual C++ . .

(workspace); , .(project): 6: : 7/* */#include

int main(void){printf("Hello World!");return 0;}

Hello World! IDE : , #include

int main(){printf(" ");printf(" !\n");return 0;} : Code:Blocks [File] [New] . [Empty File] .

. . [Build] .

[Build] Code::Blocks hello.c .

[Build]

2013 (IDE: integrated development environment): , , . Express

(project):

SDL !-> !

, []- []- C++ . .c .

:

. 25C { }, ( ), (\) C C . C .

.!

C -> -> .

main() main() . . C main() . #include int main(){printf(" ");printf(" !\n");return 0;} ( .)

. C .

A a 4 % Q ! + = ]

. (string) . C .

C is fun to learn.(integer) .

(floating-point number)

10 54 0 121 68 752547.43 0.0 0.44384 9.1923 168.470 .22 vs .

/* , , */#include Int main(){printf( %c .", 'C');printf(" %d .", 2);printf(" %.1f . ", 99.9);printf(" !");return 0;} C . 2 . 99.9 . !

Lab . printf() .

0.000000km/s. 9.800000m/s. 20 175.500000. . 4 . . . .Hint .

#include

int main(){printf(" %fkm/s. ", 300000);printf(" %fm/s. ", 9.8);

printf(" %d %f. ", 20, 175.5);printf(" %s. ", "");printf(" %d . ", 4);

return 0;} C . C C main() . C main() . C . 0 0 . . .

Supplement40 /* */#include

int main(void){printf("Hello World!");return 0;}41

Hello World! (comment): 42/* */

int main(void) /* */

/* */

. #include (header file): stdio.h: standard input output header file!: . 43#include

44(function): () = main() int main(void)

. . 45

Hello World! printf()printf() . .

46printf(Hello World!); return .47return 0;main()printf(Hello World!);return 0; #1 .48

Hello World!Kim ChulSoo 49/* */#include

int main(void){printf("Hello World!");printf(Kim ChulSoo");return 0;}Hello World!Kim ChulSoo ! \n \n .50

.51/* */#include

int main(void){printf("Hello World!\n");printf(Kim ChulSoo");return 0;}Hello World!Kim ChulSoo

#2 .52

3X1=33X2=63X3=9 .53/* */#include

int main(void){printf("3 X 1 = 3\n");printf("3 X 2 = 6\n");printf("3 X 3 = 9\n");

return 0;} . (error): (warning):

: : 0 :

54

55

56

ERROR!!

test.ctest.obj

test.exe(compiler)(linker)(execution) #157/* */#include

int main(void){printf("Hello World!\n")return 0;}--------------------Configuration: test - Win32 Debug--------------------Compiling...test.cC:\PROJECT\test\test.c(7) : error C2143: syntax error : missing ';' before 'return'Error executing cl.exe.

test.exe - 1 error(s), 0 warning(s)

; !! #258/* * /#include

int main(void){printf("Hello World!\n")return 0;}--------------------Configuration: test - Win32 Debug--------------------Compiling...test.cc:\project\test\test.c(9) : fatal error C1071: unexpected end of file found in commentError executing cl.exe.

test.exe - 1 error(s), 0 warning(s)* / -> #359/* */#include

int main(void){print("Hello World!");return 0;}--------------------Configuration: test - Win32 Debug--------------------Compiling...test.cc:\project\test\test.c(2) : fatal error C1083: Cannot open include file: 'stdio,h': No such file or directorystdio.h #460/* */#include

int main(void){print("Hello World!");return 0;}-------------------Configuration: test - Win32 Debug-------------------- Compiling... test.c C:\CPROGRAM\test\test.c(6) : warning C4013: 'print' undefined; assuming extern returning int Linking... test.obj : error LNK2001: unresolved external symbol _print Debug/test.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.

test.exe - 2 error(s), 1 warning(s) print printf .61

Hello World! Good Morning 62/* */#include

int main(void){printf("Hello World!\n");// printf("Good Morning\n");return 0;}Hello World!Good Morning \n . 63/* */#include

int main(void){printf("Hello World! ");// printf("Good Morning\n");return 0;}Hello World! Good Morning !!

: 64

F5 (Go): F10 (Step Over): ( )F11 (Step Into): ( )F9 (Breakpoint):

65Q & A66