21
“Dragon Realm” Using Bloodshed Dev-C++ Heejin Park Hanyang University

“Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

“Dragon Realm”Using Bloodshed Dev-C++

Heejin Park

Hanyang University

Page 2: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Introduction

The “Dragon Realm” Game

• Simple program 1• User defined function

• Simple program 2• strcmp() function

• Simple program 3• Sleep() function

The “Dragon Realm” Game with Dev-C++

2

Page 3: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program1

• User defined function

A Simple Example of Dev-C++

3

Page 4: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program1

• Source code

A Simple Example of Dev-C++

4

Page 5: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program2

• strcmp()function

A Simple Example of Dev-C++

5

Page 6: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program2

• Source code

A Simple Example of Dev-C++

6

Page 7: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program2

• strcmp()function• Compare characters of two strings .

• Return Value

– if Return value if < 0 then it indicates S1 is less than S2

– if Return value if > 0 then it indicates S1 is greater than S2

– if Return value if = 0 then it indicates S1 is equal to S2

A Simple Example of Dev-C++

7

Page 8: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program2

• Logical operators in c

• example

A Simple Example of Dev-C++

8

Operator name Python syntax C syntax

Logical AND a and b a && b

Logical OR a or b a || b

Page 9: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program3

• Sleep()function

A Simple Example of Dev-C++

9

Page 10: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program3

• Sleep()function• Suspend execution for an interval of time.

• The time interval for which execution is to be suspended, in milliseconds.

• example

– number is in milliseconds 2Sec = 2000 Milliseconds.

A Simple Example of Dev-C++

10

#include <windows.h>

int main(void){ Sleep(2000); ……

Page 11: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

Simple program3

• Source code

A Simple Example of Dev-C++

11

Page 12: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

Python program “Dragon Realm”

12

Page 13: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Python source code

• Dev-C++ source code

13

Page 14: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Python source code

• Dev-C++ source code

14

Page 15: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Python source code

• Dev-C++ source code

15

Page 16: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Python source code

• Dev-C++ source code

16

Page 17: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Python source code

• Dev-C++ source code

17

Page 18: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Python source code

• Dev-C++ source code

18

Page 19: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Dev-C++ source code (1/3)

19

Page 20: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Dev-C++ source code (2/3)

20

Page 21: “Dragon Realm”calab.hanyang.ac.kr/courses/ISD_taesoo/C03.Dragon_Realm.pdf · 2014-12-21 · Introduction The “Dragon Realm” Game • Simple program 1 • User defined function

The “Dragon Realm” Game with Dev-C++

• Dev-C++ source code (3/3)

21