• Sonuç bulunamadı

NEAR EAST UNIVERSITY

N/A
N/A
Protected

Academic year: 2021

Share "NEAR EAST UNIVERSITY "

Copied!
7
0
0

Yükleniyor.... (view fulltext now)

Tam metin

(1)

BASIC

PROGRAMMING

1988

NEAR EAST UNIVERSITY

(2)

(C)l992

First published 1992

(3)

PREFACE

This book is aimed for the first year University students studying Computer Programming, Computer Science, or Computer Information Systems. The topics in the book have successfully been tought to the first year CIS (Computer Information Systems) students at the Near East University. It is recommended that the book should be completed in one semester.

The material in the book has been prepared with the GW-BASIC in mind, although the book could easily be used in teaching other BASIC

programming languages as well. No previous knowledge of programming is assumed.

The book consists of two major parts. In the first part, the principles of BASIC programming are covered with a large number of examples.

Exercises are provided at the end of every chapter to help the students practice their knowledge.

The second part of the book includes a list of all the GW-BASIC functins and statements with the descriptions and example usage of each function and statement.

The recommended method of study is such that the students should have access to an online computer system, or preferably to a personal computer.

Dr. Dogan Ibrahim Mehmet Ali Tut January 1992 - Nicosia.

3

(4)

Contents:

PREFACE 3 ACRONYMS 8

1 INTRODUCTION 10

2 WHAT IS A COMPUTER 13 2.1 INPUT UNIT 14

2.2 OUTPUT UNIT 14 2.3 CPU 14

2.3.1 The Control Unit 15 2.3.2 Arithmetic & Logic Unit 15 2.3.3 Primary Storage Unit 16 2.3.4 Secondary Storage Unit 16

2.4 EXERCISES 17

3 INTRODUCTION TO PROGRAMMING 18

3.1 SOLUTION STEPS OF A PROBLEM 18

3 .1.1 Problem Definition 18 3.1.2 Problem Analysis 18

3.2 ALGORITHMIC APPROACH 19 3.3 FLOWCHART SYMBOLS 20

3.4 EXERCISES 22

4 BASIC PROGRAMMING LANGUAGE

4.1 THE BASIC LANGUAGE 24

4.2 CHARACTER SET OF BASIC 24

4.3 CONSTANTS 24

4.4 VARIABLES 26

4.5 STRUCTURE OF A EASIC PROGRAM

4.6 EXERCISES 28 . 2

7 5 STARTING UP YOUR PC 5.1

HARD DISK SYSTEMS 5.2 FLOPPY DISK SYSTE~IS

30 3

0 3 0

24

4

(5)

5.3 LOADING THE BASIC INTERPRETER 31 5.4 CREATING BASIC PROGRAMS 34 5.5 EDITING BASIC PROGRAMS 34 5.6 RETURNING BACK TO MS-DOS

5.7 EXERCISES 36 3

5 6 BASIC COMMANDS 37

6.1 INPUT STATEMENT 37 6.1.1 Feautures Of The INPUT 37 6.2 PRINT STATEMENT 39

6.2.1 Feautures Of The PRINT 41 6.3 TAB FUNCTION 42

6.4 STOP AND END STATEMENTS 44 6.5 REM STATEMENT 44

6.6 LET STATEMENT 45 6. 7 EXERCISES 46

7 ARITHMETIC IN BASIC 47 7.1 HIERARCHY OF OPERTIONS 48 7.2 STRING CONCATENATION 51 7.3 EXERCISES 52

8 BRANCHING 54

8.1 MAKING DECISIONS 56

8.2 CONDITIONAL BP-~~GHNG 56 8.3 COMBINATIONS OF CONDITIONS 58

8.4 EXERCISES 60

9 PROGRAM LOOPS 62

9.1 LOOPS WITH COTO 62 9.2 LOOPS WIT!! FC~ ... ~EXT £6

9.2.1 Nesting FOR ... N·I?Xt Loops 68 9.2.2 Loops WitL WHILE. .. WEND 70

9.3 EXERCISES 73

IO ARRAYS 79

10.1 EXERCISES S'.:

5

(6)

11 FUNCTIONS 87

11.1 BUILT-IN FUNCTIONS 88 11.2 USER FUNCTIONS 92 11.3 EXERCISES 95

12 SUBROUTINES 98

12.1 ON ... GOSUB STATEMENT 100 12.2 EXERCISES 101

13 STATEMENTS & FUNCTIONS 102 ASC

ATN BEEP CHR$

CINT CLS

cos

DATA DATE$

DEFFN DIM END EXP FIX

FOR ... NEXT GOSUB ... RETURN GOTO

IF...THEN INKEY$

INPUT INSTR -INT LEFT$

LEN LET LOCATE LOG

(7)

APPENPIX C-ASCII CHARACTERS 17 4 LP RI

NT MID$

ON ...GOSUB ON ...GOTO PRINT , READ.

REM RESTORE RETURN RIGHT$

SGN SIN SPACE$

SQR STR$

SWAP TAB TAN TIME$

.VAL

WHILE ... WEND

APPENDIX A-BASIC CHARACTERS 171 APPENDIX B-RESERVED WORDS 172

APPENDIX D-GLOSSARY 176

7

Referanslar

Benzer Belgeler

QFD is “a methodology for the development or deployment of features, attributes or functions that give a product/ service high quality” (Hwarng and Teo, 2001) QFD provides

We certify that we have read the thesis submitted by Ahmad Hamaidi titled “Academic Second/Foreign Language Speaking Anxiety in TESOL/TEFL Content areas” and reached

We certify that we have read the thesis submitted by Ahmad Hamaidi titled “Academic Second/Foreign Language Speaking Anxiety in TESOL/TEFL Content areas” and reached

Motor nerves respond to the duration of a constant pulse of 500 microseconds or shorter In electrical stimulation units a single pulse generally produces a short-lived muscle twitch of

In the same year at the Near East University Atatürk Education Faculty full time History Education Department began working as an instructor.. In 2010 she completed her master's

Constitution is about the way 'in which a state or other body is organized and is that body of fundamental doctrines and rules of a nation from which stem the duties and powers of

It is not sufficient, in order to acquire an understanding of how law impacts society, be it civil, private domestic life or industry and commerce, simply to learn large quantities

This course includes: the main definitions, structure and properties of ES, methods of knowledge acquisition and representations, certainty factors and