Simple Programming

Posted on by admin

So why would anyone in his right mind would create a whole new programming language? Isn't BASIC or C++ good enough already? Well, almost. You see, recently I got my hands on two vintage Hewlett-Packard handheld computers, an HP-95LX and an HP-200LX, and I promptly fell in love with both. FreeBASIC is a self-hosting compiler which makes use of the GNU binutils programming tools as backends and can produce console, graphical/GUI executables, dynamic and static libraries. FreeBASIC fully supports the use of C libraries and has partial C library support. The beauty of programming a game is that it can be adjusted to fit your situation. It can be simple or complicated, depending on your skill level. It can be long or short, depending on how much time you put into it.

  1. Simple Programming Interview Questions
  2. Simple Programming Games

Computer programming is the process of telling a computer to do certain things by giving it instructions. These instructions are called programs. A person who writes instructions is a computer programmer. The instructions come in different languages; they are called programming languages. Many programming languages exist. Sometimes programmers use special software, such as integrated development environments (IDEs), which have many features, including a text editor, to help them to type and edit programs.

Computers themselves understand instructions directly when those instructions are written in machine code, special sequences of characters that are able to be processed by the computer but are difficult to read by humans. Writing these instructions directly in machine code is tedious and difficult, so instructions are written in a language easier for people to use, which the computer converts into 'computer form' instructions (in other words, machine code) so the computer can follow them. The simplest of these are assembly language. Programs written in a language more like English is converted by a compiler. Some languages, called interpreted languages, use interpreters instead of assemblers or compilers.

Executables[changechange source]

Once a program has been compiled, the instructions in 'machine form' are written into a file that contains a series of numbers that the computer can understand. These files are generally called 'executables'. These machine-instructions will be loaded into the computer's memory so that the CPU can run them when the executable is opened. In the event that data is not transferred correctly, it can result in data loss.

Variables[changechange source]

A variable is a piece of the program that can be changed. Variables can include information added by the user, or answers that are found as a result of a calculation.

Conditionals[changechange source]

Conditionals are parts of the program that work if something the program can check to see whether it is true. If that part is not true, then the program won't make it happen. A conditional is often done with an 'If Statement'.

Here is an example of an if statement in the Perl programming language. What it does is it checks to see if the name variable is Bill. If the name variable is Bill, then it will print out the words 'Hi Bill!'.

Sometimes, a programmer might want to have the if statement do something else if the first part of it is not true. This is known as an else block. Here is an example of an else block in the Perl programming language.

And sometimes, the programmer might want to have multiple things for the if statement to do. For example, they may have the if block run if something is true, but will have parts of the if statement known as else if blocks that will run if the first part doesn't work, but if it works somewhere else. In the Perl programming language, else if is spelled like this, 'elsif.' Other languages might have it spelled like 'else if' however. But for Perl, it is spelled like 'elsif.' Else If blocks will only run if their condition is true, just like the first if block. An if statement can have as many else if statements as the programmer needs. If the if block, and none of the else if blocks are true, then the plain 'else' statement will be used by the program.

Comments[changechange source]

In the program, a comment is information that is meant to be read by people who are reading the program. Comments have a special symbol in front of them that tells the computer that they are comments and should not be read as code.

Comments are used to explain how a certain part of a program works. This is helpful when multiple people are working on the same program, and if they need to work on a section where someone else was working on. If the programmer that was working on it first left behind comments for any other programmer that works on it later, it will help them know faster what is going on in the program.

Here is an example of programming comments in the C programming language. In C, the two slash symbols '//' known as a forward slashes, are used. With the comments, a person can read the code and know what is going on.

Sometimes, a programmer may need to remove something from the code, but for many different reasons, they may not want to just simply delete it. An easy solution is to use the comment symbol. The computer will think that the code is just comments, rather than actual code, but the programmer will still be able to see it and read it.

Simple Programming Interview Questions

Here is an example of that in the Perl programming language. In Perl, the '#' symbol is used for comments, instead of forward slashes '//' like in the C (programming language).

Debugging[changechange source]

Computer programmers make mistakes when writing codes. The mistakes are called bugs and cause the program to follow the wrong instructions. Debugging is the process of finding and fixing the mistakes. To debug code is to find such mistakes.

There are many debugging methods. Software such as text editors and IDEs have tools that can detect specific mistakes in the codes before the program is executed. Programmers can also use programs called debuggers. A debugger can run a program step by step and track how values of specific variables change when the program is running. Programmers can use a debugger to find where the mistake happened in the code.

Simple programming projects
Retrieved from 'https://simple.wikipedia.org/w/index.php?title=Computer_programming&oldid=6552876'
Simple Programming

FreeBASIC is a free/open source (GPL), BASIC compiler for Microsoft Windows, DOS and Linux.


Get FreeBASIC

When used in its 'QB' language mode, FreeBASIC provides a high level of support for programs written for QuickBASIC. Many programs written for QuickBASIC will compile and run in this mode with no changes needed. However, for compilation in the FreeBASIC default language mode, most substantial programs will require changes.

  1. function AddNumbers( a asinteger, b asinteger)asinteger
  2. endfunction
  3. sub hello()
  4. endsub
  5. declaresub myprint( num asinteger)
  6. 'Code outside any procedures is the main part of the program
  7. print AddNumbers(1, 1)
  8. print num

FreeBASIC is a self-hosting compiler which makes use of the GNU binutils programming tools as backends and can produce console, graphical/GUI executables, dynamic and static libraries. FreeBASIC fully supports the use of C libraries and has partial C++ library support. This lets programmers use and create libraries for C and many other languages. It supports a C style preprocessor, capable of multiline macros, conditional compiling and file inclusion.

FreeBASIC has been rated close in speed with mainstream tools, such as GCC.


Get FreeBASIC

More about FreeBASIC

The FreeBASIC project is a set of cross-platform development tools, consisting of a compiler, GNU-based assembler, linker and archiver, and supporting runtime libraries, including a software-based graphics library. The compiler, fbc, currently supports building for i386-based architectures on the DOS, Linux, Windows and Xbox platforms. The project also contains thin bindings (header files) to some popular 3rd party libraries such as the C runtime library, Allegro, SDL, OpenGL, GTK+, the Windows API and many others, as well as example programs for many of these libraries.

FreeBASIC is a high-level programming language supporting procedural, object-orientated and meta-programming paradigms, with a syntax compatible to Microsoft QuickBASIC. In fact, the FreeBASIC project originally began as an attempt to create a code-compatible, free alternative to Microsoft QuickBASIC, but it has since grown into a powerful development tool. FreeBASIC can be seen to extend the capabilities of Microsoft QuickBASIC in a number of ways, supporting more data types, language constructs, programming styles, and modern platforms and APIs.

Simple Programming Games

Any type of program can be written with FreeBASIC, see our Gallery of Applications for some notable examples.