Do not miss any new update

How to program the Computer(QBASIC)

Posted by aamir khan

Hi this is Aamir we are going to learn how to program the Computer, that is, to tell it to do something for us.
This something could be calculating averages examination processing, payroll processing etc.
To do this we must speak with Computer.  This speaking or communication must be done
Through a language Understood   by the Computer and we are going to use BASIC as language for communication with Computer……



BASIC KEY WORDS

ABS    DRAW    LINE    PAINT    STEP      
AND    EDIT    LIST    PLAY    STOP      
ASC    ELSE    LLIST    POS    STR$      
ATN    END    LOAD    PRINT    STRING$      
AUTO    EOF    LOC    PRINT#    SWAP      
BEEP    FIELD    LOCATE    PSET    SYSTEM      
CHAIN    FILES    LOF    PUT    TAB      
CHR$    FIX    LOG    RANDOMIZE    TAN      
CINT    FNXXXXX    LPRINT    READ    THEN      
CIRCLE    FOR    LSET    REM    TIME$      
CLOSE    GET    MERGE    RENUM    TIMER      
CLS    GUSUB    MID$    RESTORE    TO      
COMMON    GOTO    MKD$    RETURN    TROFF      
CONT    IF    MKI$    RND    USING      
CSRLIN    INPUT    MOD    RSET    VAL      
DATA    INPUT#    NAME    RUN    WEND      
DATE$    INT    NEW    SAVE    WHILE      
DEF    INSTR    NEXT    SCREEN    WIDTH      
DEFDBL    KEY    NOT    SGN    WRITE      
DEFINT    KEY$    OFF    SIN    WRITE#      
DEFSNG    KILL    ON    SOUND      
DEFSTR    LEET$    OPEN    SPACE$      
DELETE    LEN    OR    SPC      
DIM    LET    OUT    SQR 

Problem solving on computer

Developing the solution procedure.
Coding the solution procedure in computer understandable form.
 Developing the solution procedure is one of the most important Task in problem solving.
All it involves is a liking for problem solving, a logical bent of mind, an eye for detail and a pen
And paper. Once the solution procedure is developed it can code in any computer language.
The step by step for solving the problem is also called as the logic of the problem or an
Algorithm For the problem.


Following points could be kept in mind while developing a solution procedure

a). Computer cannot solve a problem on their own.
We must give suitable instruction to the computer to solve the problem.

b). Computer do exactly what we instruct to them to do .
If by mistake we instruct the computer  to calculate ,
Gross salary = Basic salary - HRA –DA,
It will perform the subtraction of HRA and DA, even though it is logically wrong.
Thus the responsibility of developing a correct logic for the solution of a problem lies with the user and not with the Computer.

c).Computers have no responsibility of their own.
Suppose we ask the computer to perform the following addition:
TOTAL = 1+2+3+4……. +10
  A human being understand that the above statement means addition of all numbers upto 10,
But not the computer. It has to told in details as to what exactly it is suppose to do.
Therefore to perform the above addition it must be instructed as under:
 TOTAL =1+2+3+4+5+6+7+8+9+10


     Concept of Flow charting

A certain planning  is essential before any problem solved.
This planning is necessary whether it is a problem in mathematics   or an everyday problem like shopping.
Before going on a shopping trip one has to prepare list of items to be purchased, the order in which the various shops are to be visited, decided how much time and money to be spend etc.
Most of this planning is ofcourse often done sub-consciously.
But, when a problem is solved on computer it is essential to work out in detail all the decisions to be taken by the machine  the action to be performed and the sequence in which these are to be performed.
This planning is aided by flow-charts

Flowchart is the most frequently used tool to develop a solution procedure. One should be skilled in drawing flow charts to be a successful programmer.

   




For easy understanding and uniformity in the flowcharts drawn people standard flowchart symbols are in use. Figure on the following page illustrates some of the most frequently used flowchart symbols.

TERMINAL –     indicates the beginning or end of the                                       
                                Solution procedure

    PROCESSING –     indicates arithmetic’s operaters.
   


    INPUT/OUTPUT    -indicates an operator  of reading or writing.

   
    DECISION BOX    - indicates a decision point. A test is performed
                 (i.e. a condition is tested ) and the program
                flow continues on each outgoing path
                conditional to the answer to the test.



                                                            

    Annotation symbol- indicates a comment or a remark about thE Programe.



Example:
A man leaves work at the end of a day. If the time is 6.00 p.m. or earlier, he travels home by bus. If the time is later than 6.00 he has a meal in a cafe before travelling home, by bus.
Draw a flowchart of the men’s activities.

START

LEAVE WORK

   
    LATER THAN    
6.00?

HAVE A MEAL

TRAVEL HOME
BY BUS

NOTES:-
The flowchart is constructed from START terminal symbol by representing each activity as stated in the problem.
When two different activities, have a meal, not have a meal; are dependent upon the answer to a question, is time later than 6.00 p.m. ?, then the question is represented by a decision symbol, and the answer, by one of the two  flow lines leaving the symbol.
Each symbol has been annotated in English describing the operation at that stage of the flowchart.
STOP

Problem solving with flowchart.

We want to perform the following operations on two numbers say * & 4.
8+4, 8-4, 8*4,
8/4, 8^4, 8\4,
And 8 mod 4
Since we want to solve  this problem on a computer, we must first draw a flow chart.
 STEP 1     START

STEP 2     A=8+4

STEP  3     B=8-4

STEP  4     C=8*4

STEP  5     D=8/4

STEP  6     E=8^4

STEP  7     F=8 MOD 4

STEP  8     G= 8\4

STEP  9                                                                       PRINT A,B,C,D,E,F,G
STEP  10     STOP


NOW A LITLE EXPLATION ABOUT THIS FLOWCHART---
STEP 1 INDICATES THAT AT THIS POINT THE LOGIC OR THE SOLUTION PROCEDURE FOR THE PROBLEM BEINGS. THIS IS ALWAYS INDICARED BY A MESSAGE ‘START’ WRITTEN IN AN OAL SHAPED BOX.

STEP 2 THROUGH 8 INDICATE THE DIFFERENT OPERATIONS THAT WE DESIRE TO PERFORM ON THE TWO NUMBERS 8 & 4 . THE RESULT OF THESE OPERATIONS SRE STORED IN VARIABLES. A,B,C,D,E,F,G. SINCE ALL THESE ARE ARITHMETIC OPERATIONS, THEY ARE ALWAYS ENCLOSED IN THE PROCESS SMBOL.

{ 1 comments... read them below or add one }

amrootha said...

Thank you for the info. It sounds pretty user friendly. I guess I’ll pick one up for fun. thank u


ASC Coding

Post a Comment

What you Says

..-

Related Posts Plugin for WordPress, Blogger...

If you like this blog,then link back to me.
This is what you will see.



Optionally use this Widget installer to add this link to your blogger blog.