Computer programming involves analyzing a computing problem, developing algorithms to solve it, implementing those algorithms in a programming language, and testing the resulting program. The purpose of programming is to automate tasks and solve problems. Programmers write computer software by performing tasks like coding, debugging, testing, and maintaining programs. Programming languages can be high-level or low-level, with high-level languages being more abstract but easier for humans to read and write.
What is Computer Programming? Computerprogramming (often shortened to programming) is a process that leads from an original formulation of a computing problem to executable computer programs. Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation (commonly referred to as coding) of algorithms in a target programming language.
2.
Purpose The purpose ofprogramming is to find a sequence of instructions that will automate performing a specific task or solving a given problem. The process of programming thus often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.
3.
Programmers Computer programmers arethose who write computer software. Their jobs usually involve: • Coding • Debugging • Documentation • Integration • Maintenance • Requirements analysis • Software architecture • Software testing • Specification
4.
Programming Languages Different programminglanguages support different styles of programming (called programming paradigms). The choice of language used is subject to many considerations, such as company policy, suitability to task, availability of third-party packages, or individual preference. Ideally, the programming language best suited for the task at hand will be selected. Trade-offs from this ideal involve finding enough programmers who know the language to build a team, the availability of compilers for that language, and the efficiency with which programs written in a given language execute. Languages form an approximate spectrum from "low-level" to "high-level"; "low-level" languages are typically more machine-oriented and faster to execute, whereas "high- level" languages are more abstract and easier to use but execute less quickly. It is usually easier to code in "high-level" languages than in "low-level" ones.
5.
Introduction to QBASIC BASICstands for Beginner’s All Purpose Symbolic Instruction Code. It was invented in 1963, at Dartmouth College, by the mathematicians John George Kemeny and Tom Kurtzas.
6.
Features of QBASIC 1.It is a user friendly language. 2. It is widely known and accepted programming language. 3. It is one of the most flexible languages, as modification can easily be done in already existing program. 4. Language is easy since the variables can be named easily and uses simple English phrases with mathematical expressions.
7.
Rules of QBASIC Everyprogramming language has a set of rules that have to be followed while writing a program, following are some rules of QBASIC language: 1. All Qbasic programs are made up of series of statements, which are executed in the order in which they are written. 2. Every statement should have at least one Qbasic command word. The words that BASIC recognizes are called keywords. 3. All the command words have to be written using some standard rules, which are called “Syntax Rules”. Syntax is the grammar of writing the statement in a language. Syntax Errors are generated when improper syntax is detected.
8.
QBASIC DATA Data isa collection of facts and figures that is entered into the computer through keyboard. Data is of two types: 1. CONSTANT a. Numeric Constant b. Alphanumeric Constant/String 2. Variable a. Numeric Variable b. Alphanumeric Variable
9.
Constant Data whose valuedoes not change or remains fixed. There are two types of constants: a. Numeric Constant: Numbers – negative or positive used for mathematical calculations e.g. – 10,20,0 b. Alphanumeric Constant/String: Numbers or alphabets written within double quotes(inverted commas “ “). e.g. “Computer”, “Operating System”
10.
Variable Data whose valueis not constant and may change due to some calculation during the program execution. It is a location in the computer’s memory, which stores the values. Depending on what value is held. Variables are of two types: a) Numeric Variable: The variable that holds a Numeric Constant for arithmetic calculations (+, -, *, /) is called a Numeric Variable. e.g. A=50, here A is the Numeric Variable b. Alphanumeric Variable: The variable that holds an Alphanumeric Constant, which cannot be used for arithmetic calculations, is called Alphanumeric Variable or String Variable. An Alphanumeric variable must end with a $ sign and the Alphanumeric constant must be enclosed in inverted commas. e.g. Name$=“Akanksha”, here Name$ is an Alphanumeric Variable
11.
Types of Modein QBASIC Once QBASIC program is loaded into the computer memory, it displays Ok prompt. Ok means it is ready to accept the commands. QBASIC can be made to translate in two modes: 1. Direct Mode 2. Program Mode
12.
Direct Mode The modeaccepts single line instructions from the user and the output is viewed as soon as enter key is pressed. The instructions are not stored in the memory. This mode can be used to do quick calculations. They do not have line numbers. e.g. Print 3+4 Print “This is the Direct mode in QBASIC”
13.
Program Mode The modeis used to type a program which is stored in the memory. They have line numbers. We have to give the command to get the output. e.g. 10 Print 3+4 20 End RUN
14.
Command/Keywords in QBASICand their Functions The following commands do not need line number. 1. LIST- The command is used to list the program on the screen. 2. RUN- The command is used to execute the program. 3. LLIST- The command is used to list of program as a hardcopy. 4. LPRINT- The command is used to get the output of the program on the hard copy. 5. NEW- The command is used to clear the memory of the existing program. 6. SYSTEM- The command is used to take you back to dos prompt. 7. PRINT AND CLS command can also be used without a line number. Print is used to view the display on the screen and CLS to clear the screen. 8. RME- The command is used to show the position of the mistake. 9. SAVE- The keyword is used to save the program. 10. LOAD- The keyword is used to LOAD the program from disk to the memory.
15.
QBASIC REMINDERS A QBASICprogram consists of lines containing 1. A line number 2. A QBASIC keyword like PRINT, END etc. 3. Each program line begins with positive number. 4. No two lines should have same number.
16.
Running a Program RUNis the command used to execute the program and get the output on the screen. Writing a New Program It is possible to overwrite lines with the new statements, but if you want to write a totally new program use a NEW command. Exiting QBASIC In order to exit the QBASIC program SYSTEM command is used.