Вы находитесь на странице: 1из 5

CHAPTER NO.

9
PROBLEM SOLVING
PROBLEM SOLVING: To reach at the solution of a problem is called Problem Solving. PROBLEM SOLVING ON COMPUTER: Problems can be solved on computers also. This requires the knowledge of developing the software for the solution of the problem. Computer programming can be best described as the problem solving. Two basic steps of the problem solving process are 1. To ensure that the correct problem is being solved 2. To develop a correct logic to solve the problem PROGRAMME PREPARATION: The problem solving process starts with the problem specification and ends with a correct (concrete) programme. The steps involved in problem solving are 1. 2. 3. 4. Problem Identification Stage Planning Stage Coding and Testing Stage Implementing and Documenting Stage

Now we will describe one by one 1. PROBLEM IDENTIFICATION STAGE Defining/Specifying the problem [also called Theme] Defining/Specifying the problem by answering to questions as: What the computer programme do? What tasks will it perform? What kind of data will it use, and where will get its data from? What will be the output of the programme?

How will the programme interact with the computer user?

Specifying the problem requirements forces us to state the problem clearly and unambiguously and to gain a clear understanding of what is required for its solution. The objective is to eliminate unimportant aspects and to focus on the root problem, and this may not be as easy as it sounds. Analyzing the problem [Analysis] Analyzing the problem involves identifying the problem (a) inputs, that is, the data you have to work with (b) outputs, the desired results (c) any additional requirements or constraints on the solution. 2. PLANNING STAGE Algorithm development: [Design] This stage consists of developing an algorithm for its solution. Write step-by-step procedure and then verify that the algorithm solves the problem as intended. Flowchart (Pictorial view of algorithm): A graphical representation that uses graphic symbols and arrows to express the algorithms.
Benefits of Using Flowcharts

Promote process understanding Provide tool for training Identify problem areas and improvement opportunities Depict customer-supplier relationships

Pseudocode

A narrative description of the flow and logic of the intended program, written in plain language that expresses each step of the algorithm. 3. CODING AND TESTING STAGE Coding (or programming): Coding is the process of translating the algorithm into the syntax of a given programming language. We must convert each algorithm step into one or more statements in a programming language. Testing and debugging: Testing means running the program, executing all its instructions/functions, and testing the logic by entering sample data to check the output. Debugging is the process of finding and correcting program code mistakes: Syntax errors: Syntax errors are caused due to the wrong use of programming language. This involves incorrect punctuation, word sequence or undefined terms. Logic errors (or so called bugs): Logical errors are caused due to improper use of formula or due to incorrect formula. Run-time errors (Execution Errors): These errors are caused due to the limitation of the computer. 4. IMPLEMENTING AND DOCUMENTING STAGE Implementation: The implementation is the state in which the programme is bring into operation to check the correctness and reliability of the programme. Documentation: The stage of documentation consists of two sub stages which are 1. User documentation: This documentation is made for the users of the programme telling the user about the characteristics and functions of the programme. This also tells the user how to operate the programme. 2. Technical documentation: Technical documentation helps the developers and analysts to find the problems and in case of any modification in the programme.

CHAPTER NO. 10
3

DATA TYPES, ASSIGNMENT AND INPUT/OUTPUT STATEMENTS


BASIC is an easy high level computer programming language. BASIC PROGRAMMING This is the first high level language that was used on micro-computers. BASIC has the following features in all its versions It is easy and user friendly Simple syntax rules and easy to test and debug Well suited for computers having limited memory.

CHARACTER SET IN BASIC LANGUAGE BASIC consists of following character sets Alphabetic Characters: BASIC deals capital letters A,B,C,..Z as well as small letters a,b,c,,z Numeric Characters: Digits are 0, 1, 2... 9 Special Characters: Special characters are $,#,%,@, blank spaces, punctuation marks e.g. ! , ; : ? etc. Arithmetical, Relational Operators: Arithmetical characters + - * / ^) ( Relational Operators =>< etc. RESERVED WORDS These are special meaning words. These are reserved and cannot be used other than they are made for. e.g. ABS, AND, AUTO, CALL, BEEP etc. COMMANDS Commands are executable instructions. AUTO CLEAR Automatically generates line number when ENTER key is pressed Clears the value assigned to numeric and string variable (CLS/HOME) DELETE Deletes the programme lines or line range (e.g. DELETE 10) EDIT Edits a specified line number (e.g. EDIT 40) FILES Displays the name of all the files from a specified drive, or with a specific extension 4

KILL Deletes the file from the disk (KILL <filename>) LIST Displays the programme or part of the programme currently in memory LOAD Loads a file from the diskette into memory NEW Deletes the programme currently in memory and clears all variables RENUM Renumbers the programme line without changing the order of the execution RUN Begins the execution of the programme SAVE Save the programme file into memory SYSTEM Exists from BASIC and returns to DOS DATA TYPES Basic keeps its data type simple. Numeric Data: BASIC deals with numbers that are used in calculations (e.g.. 17,20) String Data: BASIC deals with words or text. (e.g. Pakistan) Constants:

Вам также может понравиться