Gw Basic Programs For 10th Class

Posted on -
Jump to navigationJump to search

Programing With GW-Basic. For check the number'.Programming with GW-basic (10TH) Program # 4 CLS 10 REM this program is used. For Class 9th 10th.

GW-BASIC
DeveloperMicrosoft
First appeared1983; 36 years ago
Stable release
OSDOS
Influenced by
IBM Cassette BASIC, IBM Disk BASIC, IBM BASICA
Influenced
QBasic, QuickBasic, MSX BASIC

GW-BASIC is a dialect of the BASICprogramming language developed by Microsoft from BASICA, originally for Compaq. It is otherwise identical to Microsoft/IBM BASICA, but is a fully self-contained executable and does not need the ROM BASIC. It was bundled with MS-DOSoperating systems on IBM PC compatibles by Microsoft. Microsoft also sold a BASIC compiler, BASCOM, compatible with GW-BASIC, for programs needing more speed. The language is suitable for simple games, business programs and the like. Since it was included with most versions of MS-DOS, it was also a low-cost way for many aspiring programmers to learn the fundamentals of computer programming.[1][2] With the release of MS-DOS 5.0, GW-BASIC's place was eventually taken by QBasic, the interpreter part of the separately available QuickBASIC compiler.[3]

Features[edit]

IBM BASICA and GW-BASIC were largely ports of MBASIC version 5.x, but with added features specifically for the IBM PC hardware. Common features of BASIC-80 5.x and BASICA/GW-BASIC include:

  • WHILE..WEND loops
  • Variable names of up to 40 characters
  • OPTION BASE statement to set the starting index of array variables as either 0 or 1
  • Dynamic string space allocation
  • LINE INPUT statement for reading in data from the keyboard
  • CALL statement for executing machine language routines
  • CHAIN and MERGE commands
  • Ability to save programs in either tokenized binary format or ASCII text

The ability to 'crunch' program lines by omitting spaces, a common feature of earlier Microsoft BASIC implementations, was removed from BASIC-80 5.x and BASICA/GWBASIC.

BASIC-80 programs not using PEEK/POKE statements would run under GW-BASIC. BASICA added a large number of features for the IBM PC such as sound, graphics, and memory commands. A few other features not present in BASIC-80 included the ability to execute the RND function with no parameters and the ability to also save programs in a 'protected' format, preventing them from being LISTed. BASICA also allowed double-precision numbers to be used with mathematical and trigonometric functions such as COS, SIN, and ATN, which wasn't allowed in 8-bit versions of BASIC. This feature was normally not enabled and required the optional parameter /D at startup, i.e., GWBASIC /D. BASIC's memory footprint was slightly increased if it was used.

Microsoft did not offer a generic version of MS-DOS until v3.20 in 1986; before then, all variants of the operating system were OEM versions. Depending on the OEM, BASIC was distributed as either BASICA.EXE or GWBASIC.EXE. The former should not be confused with IBM BASICA, which always came as a .COM file. Some variants of BASIC had extra features to support a particular machine. For example, the AT&T and Tandy versions of DOS included a special GW-BASIC that supported their enhanced sound and graphics capabilities.

The initial version of GW-BASIC was the one included with Compaq DOS 1.13, released with the Compaq Portable in 1983, and was analogous to IBM BASICA 1.10. It used the CP/M-derived file control blocks for disk access and did not support subdirectories. Later versions added this feature and improved graphics and other capabilities.

GW-BASIC 3.20 (1986) added EGA graphics support (no version of BASICA or GW-BASIC had VGA support) and was, in effect, the last new version released before it was superseded by QBasic.

Buyers of Hercules Graphics Cards received a special version of GW-BASIC on the card's utility disk that was called HBASIC and which added support for its 720×348 monochrome graphics. Other versions of BASICA/GW-BASIC did not support Hercules graphics and could only display graphics on that card through the use of third-party CGA emulation, such as SIMCGA.

GW-BASIC has a command line-based integrated development environment (IDE) based on Dartmouth BASIC. Using the cursor movement keys, any line displayed on screen can be edited. It also includes function key shortcuts at the bottom of the screen. Like other early microcomputer versions of BASIC, GW-BASIC lacked many of the structures needed for structured programming such as local variables, and GW-BASIC programs executed relatively slowly, because it was an interpreted language. All program lines must be numbered; all non-numbered lines are considered to be commands in direct mode to be executed immediately. Program source files are normally saved in binary compressed format with tokens replacing keywords, with an option to save in ASCII text form.[4]

The GW-BASIC command-line environment has commands to RUN, LOAD, SAVE, LIST the current program, or quit to the operating SYSTEM; these commands can also be used as program statements. There is little support for structured programming in GW-BASIC. All IF/THEN/ELSEconditional statements must be written on one line, although WHILE/WEND statements may group multiple lines. Functions can only be defined using the single line DEF FNf(x)=<mathematical function of x> statement (e.g., DEF FNLOG(base,number)=LOG(number)/LOG(base)). The data type of variables can be specified with a character at the end of the variable name: A$ is a string of characters, A% is an integer, etc. Groups of variables can also be set to default types based on the initial letter of their name by use of the DEFINT, DEFSTR, etc., statements. The default type for undeclared variables not identified by such typing statements, is single-precision floating point (32-bit MBF).[5]Block rosetta stone host file.

GW-BASIC allowed use of joystick and light pen input devices. GW-BASIC can read from and write to files and COM ports; it can also do event trapping for ports. Since the cassette port interface of the original IBM PC was never implemented on compatibles, cassette operations are not supported. GW-BASIC can play simple music using the PLAY statement, needing a string of notes represented in a music macro language, e.g., PLAY 'edcdeeL2edfedL4c'. More low-level control is possible with the SOUND statement, which takes the arguments of a frequency in hertz and a length in clock ticks for the standard internal PC speaker in IBM machines. Consequently, sound is limited to single channel beeps and whistles as befits a 'business' machine. Home-based PCs like the Tandy 1000 allowed up to three channels of sound for the SOUND and PLAY commands.[5]

Name[edit]

There are several theories on what the initials 'GW' stand for. Greg Whitten, an early Microsoft employee who developed the standards in the company's BASIC compiler line, says Bill Gates picked the name GW-BASIC. Whitten refers to it as Gee-Whiz BASIC and is unsure if Gates named the program after him.[6] The Microsoft User Manual from Microsoft Press also refers to it by this name.[citation needed] It may have also been nicknamedGee-Whiz because it had a large number of graphics commands.[6] Other common theories as to the initials' origins include 'Graphics and Windows', 'Gates, William' (Microsoft's president at the time), or 'Gates-Whitten' (the two main designers of the program).[7][8]

Throughout the last few years, Capcom has focused more and more on creating games for the survival-horror genre and less on the fighting games the company was once so well known for. The headliner of that genre is Capcom’s Resident Evil franchise, a series so distinct that the company’s other survival-horror line, Dino Crisis, was once commonly referred to as “Resident Evil with dinosaurs” (although it later distinguished itself with a more action-oriented sequel). Psp game.

See also[edit]

  • Microsoft Binary Format (MBF)

References[edit]

  1. ^'KindlyRat'. 'GW-BASIC'. Archived from the original on 2005-07-26. Retrieved 2009-11-10.
  2. ^'Leon'. 'GWBASIC Games & Other Programs'. Archived from the original on 2009-10-26. Retrieved 2009-11-10.
  3. ^'Microsoft BASIC version information'. Retrieved 2008-06-12.
  4. ^'GW-BASIC Documentation and Utilities'. Archived from the original on 2007-12-17.
  5. ^ ab'GW-BASIC User's Guide'. 1987. Retrieved 2008-06-28.
  6. ^ abGregory Whitten (2005-04-13). 'GW-BASIC'. Archived from the original on 2008-09-20. Retrieved 2008-06-29.
  7. ^'Linux Dictionary:G'. Retrieved 2008-06-28.
  8. ^'GW-BASIC'. 2005-04-13. Archived from the original on 2008-06-29. Retrieved 2008-06-28.

External links[edit]

  • Classic Basic Games Page, a resource for BASIC games and other programs
  • Back to BASICs, another BASIC resource site
  • GW-BASIC interpreter program and files download site at the Wayback Machine (archived October 27, 2009)
  • Gary Beene's Information Center regarding BASIC, with timeline dates for DOS, Windows and BASIC dialects
  • GW-BASIC - Gee Whiz! Neil C. Obremski's site devoted to GW-BASIC.
  • PC-BASIC - a GW-BASIC emulator for modern operating systems.
Retrieved from 'https://en.wikipedia.org/w/index.php?title=GW-BASIC&oldid=887236299'
Categories:
Hidden categories:

Dear students I am updating this page as well, so keep visiting this page to find/read the updated material/topics.

=> Code to write the ASCII Code and their respective Characters (using Sub-routines)

10 PRINT 'ASCII CODE','CHARACTER'

20 FOR K=65 TO 90

30 GOSUB 60

40 NEXT K

50 END

60 PRINT K,CHR$(K)

70 RETURN



Here the function CHR$ converts the number passed from its arguments, means from '()' brackets, to its equivalent CHARACTER.
Reverse of this is ASC function which converts the CHARACTER passed from its arguments to its equivalent ASCII CODE
Example is given below
10 INPUT 'ENTER ANY CHARACTER';C$
20 PRINT 'THE ASCII CODE OF CHARACTER IS';ASC(C$)


Free Gw Basic Programs

You can see from the above output that when we INPUT the character T (capital T) then it is showing its ASCII CODE, that is, 84. And when we INPUT the character s (small s) then it shows ASCII CODE 115, that is code of small s (because the ASCII CODES of small ABC range between 97 to 122)
=> Code to INPUT a string and PRINT it in reverse order (like NATSIKAP forPAKISTAN)
10 INPUT 'ENTER ANY STRING';ST$
20 FOR J=LEN(ST$) TO 1 STEP -1
30 PRINT MID$(ST$,J,1);
40 NEXT J
50 END

Output
=> Code to PRINT any STRING in triangle format, like following format
Like if we INPUT the string PAKISTAN then the output will be
P
PA
PAK
PAKI
PAKIS
PAKIST
PAKISTA

Gw Basic Programs For 10th Class Free Download

PAKISTAN
Code
10 INPUT 'ENTER ANY STRING';ST$
20 FOR OUTER=1 TO LEN(ST$)
30 FOR INNER=1 TO OUTER
40 PRINT MID$(ST$,INNER,1);
50 NEXT INNER
60 PRINT
70 NEXT OUTER
80 END

Output

Now to print the triangle in REVERSE order use the following code (modified code is highlighted)

10 INPUT 'ENTER ANY STRING';ST$
20 FOR OUTER=LEN(ST$) TO 1 STEP -1
30 FOR INNER=1 TO OUTER
40 PRINT MID$(ST$,INNER,1);
50 NEXT INNER
60 PRINT
70 NEXT OUTER
80 END

Output
=> Code to INPUT 5 subjects and then PRINT any RANDOM subject out of those
10 RANDOMIZE TIMER
20 DIM SUB$(5)
30 FOR K=0 TO 4
40 INPUT SUB$(K)
50 NEXT K
60 PRINT 'RANDOMLY SELECTED SUBJECT IS ';SUB$(INT(RND*5))
70 END

Output

Gw Basic Programs For Class 10



=> Code to sort the numbers, arrange them in ascending order, (using arrays)

10 DIM NUM(5)

20 FOR K=0 TO 4

30 INPUT NUM(K)

40 NEXT K

50 FOR I=1 TO 4

60 FOR J=0 TO 4-I

70 IF NUM(J) >NUM(J+1) THEN LET TMP=NUM(J):NUM(J)=NUM(J+1):NUM(J+1)=TMP

80 NEXT J

For

90 NEXT I

100 PRINT'NUMBERS IN ASCENDING ORDER ARE'

110 FOR H=0 TO 4

120 PRINT NUM(H)

130 NEXT H

140 END


Output
Using almost the same program you can find the Greatest number and the Smallest number. You just have to sort the array in ASCENDING order first, then the 1st element of array will be the smallest and the last element of array will be the greatest or largest element (because the array is already sorted and we know that the smallest element comes at the 1st position and largest element will be at the last position of array).
Code with some modification (highlighted text) is shown below:
10 DIM NUM(5)
20 FOR K=0 TO 4
30 INPUT NUM(K)
40 NEXT K
50 FOR I=1 TO 4
60 FOR J=0 TO 4-I
70 IF NUM(J) > NUM(J+1) THEN LET TMP=NUM(J):NUM(J)=NUM(J+1):NUM(J+1)=TMP
80 NEXT J
90 NEXT I
100 PRINT 'NUMBERS IN ASCENDING ORDER ARE'
110 FOR H=0 TO 4
120 PRINT NUM(H)
130 NEXT H
140 PRINT 'THE SMALLEST ELEMENT IS ';NUM(0)
150 PRINT 'THE LARGEST ELEMENT IS ';NUM(4)

160 END

Output