QBasic: Looping

January 15, 2010

In programming, loops are used to repeat an instruction for as much as needed. There are a few ways to loop in BASIC:


An example of the IF THEN GOTO loop can be found here where we used those commands to check for a triangle. The program will keep on asking for the right values to enter (the ones of a real triangle) thus creating a loop that’s stopped when the right values are entered.
Read the rest of this entry »


C++: Programming in Linux – Hello World

January 12, 2010

C++ is one of the most widely used programming languages today. I’m not going to talk about it in general but skip to the first example, which would be the Hello World program.
Before we start you should know that Ubuntu has an included C++ compiler called G++, so you won’t be needing a C++ IDE. I’ll be writing the programs here on GEdit (plain text editor) and compile it with G++. Also Ubuntu has an integrated debugger called GDB. Those two work on the command line, don’t be scared it isn’t complicated.
Read the rest of this entry »

A brief history of computers

January 10, 2010

The history of computers is divided into 5 generations:

First generation (1951. – 1959.):
The first computers were constructed for scientific purposes only. In 1951 computers have started to be used in commercial use too. The basic element of this generations computers is the electron tube. The computers dimensions where big, their speed slow and they were undependable. The first general-purpose electronic computer was ENIAC (Electronic Numerical Integrator And Calculator). It’s weight was over 30 tons, it consisted of 18.000 electron tubes, 70.000 resistors, 10.000 capacitors and 1.500 relays. It consumed roughly 174 kWh of electric power and his speed was about 300 calculations per second and had a volume of 100m^3. It’s existence was published on the 16.02.1946 and that date is considered the start of the computer revolution.
Another computer from that generation was the UNIVAC (Universal Automatic Computer) Computer System. It was the first commercial computer which processed text and numbers. It was build by J. Presper Eckert and John Mauchly. Those two started the Eckert-Mauchly Computer Corporation back in 1946. These two experts worked earlier on ENIAC and EDVAC together. Their mathematical consult was John von Neuman who created the logical computer structure with input output devices, memory and a central processing unit.
Read the rest of this entry »

QBasic: An example of INPUT, IF-THEN-ELSE, GOTO commands

December 14, 2009

A program for calculating the area of a triangle using Heron’s formula:


'Program description, it's always good to have one at the top
PRINT "A program for calculating the area of a triangle using Heron's formula."
10 PRINT "Input the value of the triangle's sides:"
INPUT "a = ";a
INPUT "b = ";b
INPUT "c = ";c

'Check if it's a triangle
IF (a < 0 OR b < 0 OR c < 0 OR a + b < c OR a + c < b OR b + c < a) THEN
PRINT "That is not a triangle. Try again."

s = (a + b + c)/2
P = s * (s - a) * (s - b) * (s - c)
P = P ^ (1 / 2)

'Result print-out
PRINT "P = ";P

'Repeat the program
20 INPUT "Repeat the program [press 1 for YES, and 2 for NO]"; out%
IF (out% 1 AND out% 2) THEN
PRINT "Wrong input!"

ELSEIF out% = 1 THEN GOTO 10

Read the rest of this entry »

QBasic: Data Types

December 13, 2009

Every variable used in the program has data type. A variable is created the first time it is referenced in your code, such as when you first set a value to it. As stated before, there are five types of variables. Each one has its own associated suffix to identify its type. It is a wise programmer who learns to use the appropriate data-type for the purpose they choose their variable, and to select the maximum storage (number of bytes) required.
Read the rest of this entry »

Introduction to Web Development

December 10, 2009

As a part of my blog I will include a Web Development category. Here I’ll write about, well, web development, which will include examples of HTML/CSS coding in JavaScript/PHP maybe/etc., using common CMS’s maybe even review some alternative CMS platforms, I’ll probably write about servers and databases too but I think I’ll do that in another category not this one, and other stuff that comes to my mind.

Read the rest of this entry »

QBasic: Installing on Linux and writing your first program

December 9, 2009

Basic is a fairly easy programming language to learn for beginners, that’s why I’m starting with that particular language and will work my way up the complexity scale.
QBasic is an IDE (Integrated development environment) and an interpreter for the BASIC programming language. It was developed by Microsoft more than 20 years ago. And being developed by MS it runs only on Windows, but thanks to emulators, namely Wine, it’s possible to run in it under Linux also. All you need to do to install Wine emulator on your Linux box is to write into the terminal this line:

sudo apt-get install wine

Read the rest of this entry »