Presentation is loading. Please wait.

Presentation is loading. Please wait.

BASIC Programming Language. Overview Install Just BASIC Run BASIC Programs Syntax of BASIC –Data, Variables, and Calculations –Input/Output –Decisions.

Similar presentations


Presentation on theme: "BASIC Programming Language. Overview Install Just BASIC Run BASIC Programs Syntax of BASIC –Data, Variables, and Calculations –Input/Output –Decisions."— Presentation transcript:

1 BASIC Programming Language

2 Overview Install Just BASIC Run BASIC Programs Syntax of BASIC –Data, Variables, and Calculations –Input/Output –Decisions Assignment

3 BASIC Language BASIC is not a word. It is the acronym for Beginner's All-purpose Symbolic Instruction Code. In 1975, MITS released Altair BASIC, developed by Bill Gates and Paul Allen as the company Micro-Soft, which grew into today's corporate giant, Microsoft. The first Altair version was co-written by Gates, Allen, and Monte Davidoff. Versions of Microsoft BASIC (also known then, and most widely as M BASIC or MBASIC) was soon bundled with the original floppy disk-based CP/M computers, which became widespread in small business environments.~ Wikipedia

4 8 Design Principles of BASIC Be easy for beginners to use. Be a general-purpose programming language. Allow advanced features to be added for experts (while keeping the language simple for beginners). Be interactive. Provide clear and friendly error messages. Respond quickly for small programs. Not to require an understanding of computer hardware. Shield the user from the operating system. –We shall see one on Windows and one on FreeBSD

5 Install Just BASIC v1.01 Connect to your PC by Remote Desktop. Download Just BASIC at http://Course.ipv6.club.tw/CS101/jbwin101.exe http://Course.ipv6.club.tw/CS101/jbwin101.exe Install it in an appropriate folder. If you cannot access your remote PC, install it under Z:\ or the Desktop( 桌面 ) of the computer in the classroom.

6 Run BASIC Programs Run Shift-F5

7 A Sample Program A = 10 B = 20 C = A + B PRINT C END

8 Syntax of BASIC Data –Numbers1, -5, 3.7, -0.2 –Strings“India”, “This is a book.” Variable –A variable is a name used in the code that represents a string or numeric value. myNumber=3 PRINT myNumber –A variable name can start with any letter and it can contain both letters and numerals

9 A = A + 1 A = 10 PRINT A A = A + 1 PRINT A END

10 Arithmetic 2+1 4-1 2*3 3/5 8 MOD 5 2+4*5 (2+4)*5

11 Input INPUT statement –To prepare the program for user input from the terminal (keyboard) during program execution. INPUT [prompt string;] list of variables –prompt string is a request for data to be supplied during program execution. (must be surrounded by double quotation marks”. Example –INPUT “Enter NAME and age”; N$, AGE

12 Output PRINT –PRINT N$, AGE –PRINT N$; AGE –PRINT 10; 20; 30 –PRINT 10, 10+10, 3*5 –PRINT AGE - 5

13 Decision IF condition THEN expression(s) IF condition THEN expression(s)1 ELSE expression(s)2 IF condition THEN expression(s)1 END IF IF condition THEN expression(s)1 ELSE expression(s)2 END IF

14 Assignment: Chinese Remainder Theorem 韓信點兵又稱為中國餘數定理,相傳漢高 祖劉邦問大將軍韓信統御兵士多少,韓信 答說,每 3 人一列餘 1 人、 5 人一列餘 2 人、 7 人一列餘 4 人 … 。劉邦茫然而不知其數。 中國有一本數學古書「孫子算經」也有類 似的問題:「今有物,不知其數,三三數 之,賸二,五五數之,賸三,七七數之, 賸二,問物幾何?」答曰:「二十三」

15 Algorithm 三三數之賸二,置一百四十,五五數之賸 三,置六十三,七七數之賸二,置三十, 并之,得二百三十三,以二百一十減之, 即得。凡三三數之賸一,則置七十,五五 數之賸一,則置二十一,七七數之賸一, 則置十五,即得。 Input: R3, R5, R7 Calculation: –(R3*70 + R5*21 + R7*15) mod 105


Download ppt "BASIC Programming Language. Overview Install Just BASIC Run BASIC Programs Syntax of BASIC –Data, Variables, and Calculations –Input/Output –Decisions."

Similar presentations


Ads by Google