36
Qbasic Tutorial 2.1 Variables and Data Types

Qbtut2.1

Embed Size (px)

Citation preview

Page 1: Qbtut2.1

Qbasic Tutorial 2.1

Variables and Data Types

Page 2: Qbtut2.1

Variables

● Hold Data in Memory.● Are assigned to a Data Type.● The data can change at any time during the program's

operation.● The data entered must be the same type as the assigned

Data Type.

Page 3: Qbtut2.1

Qbasic Data Types

● String - Text and Characters● Integer - Non point number between -32,768 to 32,767● Long - Non point number between - 2,147,483,648 to

2,147,483,647

Page 4: Qbtut2.1

Qbasic Data Types

● Single – Floating Point from -3.37 x 1038 to 3.37 x 1038

● Double – Floating Point from -1.67 x 10308 to 1.67 x 10308

Note: Qbasic has problems with the double data type.This problem is not there in QB64.I will be using QB64 for this tutorial.

Page 5: Qbtut2.1

The Signs to be added after variables

● String - $● Integer - %● Long - &● Single - !● Double - #

Page 6: Qbtut2.1

QB 64 Data types

● _Integer64 - &&

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

● _Float - ##

-1.18 x 104932 to 1.18 x 104932

Page 7: Qbtut2.1

Tutorial 2.1

This tutorial will use:

QB64 running on Windows 7 Ultimate 64 bit

and

Qbasic [running in DOSBox on (W7)] and running normally on WinXP 32 bit.

Page 8: Qbtut2.1

First, I'll show the data type error....

Page 9: Qbtut2.1

So, I open this ..... and press F5

Page 10: Qbtut2.1

And, This is what I get!

Page 11: Qbtut2.1

So, I got 3.2 and a bunch of other numbers.

Page 12: Qbtut2.1

Now, To make sure....

Page 13: Qbtut2.1

But YAY!

Page 14: Qbtut2.1

Again,

Page 15: Qbtut2.1

AaaaaaaRgggggHH!

Page 16: Qbtut2.1

So, I got 3.59999999Insted of 3.6

Now you understand?

Page 17: Qbtut2.1

Old Method

First, I will teach you the old method of definig variables

Page 18: Qbtut2.1
Page 19: Qbtut2.1
Page 20: Qbtut2.1
Page 21: Qbtut2.1
Page 22: Qbtut2.1
Page 23: Qbtut2.1
Page 24: Qbtut2.1
Page 25: Qbtut2.1

Hey I forgot to print the header!

Page 26: Qbtut2.1
Page 27: Qbtut2.1
Page 28: Qbtut2.1

New Method

● This is the new method for variables● Visual BASIC also uses this method.

Page 29: Qbtut2.1
Page 30: Qbtut2.1
Page 31: Qbtut2.1
Page 32: Qbtut2.1
Page 33: Qbtut2.1
Page 34: Qbtut2.1
Page 35: Qbtut2.1
Page 36: Qbtut2.1

That is all. Thank you.

Don't forget to download the source codes zip

and

If you like this, please comment and rate accordingly.

Thank you