Skip to main content

Problem Solving Using Computer

Before writing a computer program, we must be clear about the processing steps to be performed by the computer. Hence, in order to ensure that the program/instructions are appropriate for the problem and are in the correct sequence, program must be planned before they are written. The problem solving contains a number of steps which are as below.

   Steps in problem solving by Computer


1)      Problem Analysis:
                Before solving a problem, it should be analyzed well. It is impossible to solve a problem by using computer without clear understanding & identification of the problem. Thus, problem analysis contains different activities like determining input/output, software and hardware requirement, time constraints, different types of users, accuracy etc. 

2)      Algorithm Development:
                Algorithm is step by step description of the method to solve a problem. In other words, it can be defined as a sequence of instructions designed in such a way that if the instructions are executed in the specified sequence, the desired result is obtained.
 Example: write an algorithm to solve the problem which tests a number for even or odd.

Step1: Start
Step2: Read a number.
Step3: Divide the number by 2 and check the remainder.
Step4: If the remainder in step 3 is zero,
              Display the number as even otherwise as odd.
Step5: Stop.

3)      Flowchart:
Flowchart is the graphical representation of the algorithm using standard symbols. In other words, flowchart is a pictorial representation an algorithm that uses boxes of different shapes to denote different types of instruction. The actual instructions are written within these boxes using clear statement. The boxes are connected by solid lines having arrow marks to indicate the flow of operation.
      Flowchart  Symbols 
  
Example of flow chart:
       Draw flowchart to solve the problem which tests the number for even or odd.      
             

4)      Coding:
             This is the process of transforming the program logic design into a computer language format. This stage translates the program design into computer instructions. These instructions are the actual program or software product. It can be said that coding is the act of transforming operations in each box of the flowchart in terms of the statement of the programming.

5)      Compilation and Execution:
                      The process of changing high level language into machine level language is known as compilation. It is done by a compiler. Once the compilation is completed then the program is linked, loaded and finally executed. The original high level language is called the source program and the resulting machine language program is called object program.

6)      Debugging & Testing:
              Debugging is the discovery and correction of programming errors. Even after taking full care in program design, some errors may remain in the program because the designer might have never thought about a particular case. These errors are detected only when we start executing the program in a computer. Such types of program errors are called BUGS and process of removing these BUGS is knows as debugging.
                Testing is the validation of the program. Testing ensures that program performs correctly the required tasks. The program testing and debugging are closely related.

7)      Program Documentation:

               Documentation of program helps to those who use, maintain and extend the program in future. Properly documented program is useful and efficient in debugging, testing, maintenance and redesign process. A properly documented program can easily be used again when needed and an undocumented program usually requires much extra work. Among the techniques commonly found in documentation are flowcharts, comments, memory maps, and parameter & definition list.

Comments

Popular posts from this blog

Passing arrays to functions in C programming

Like any other variables, we can also pass entire array to a function. An array name can be named as an argument for the prototype declaration and in function header. When we call the function no need to subscript or square brackets. When we pass array that pass as a call by reference because the array name is address for that array. /* Program to illustrate passing array to function */ #include<stdio.h> void display(int) ; /* function prototype */ main( ) { int num[5] = {100, 20, 40, 15, 33, i ; clrscr( ) ; printf (“\n The content of array is \n”) ; for (i=0; i<5; i++) display (num[i]) ; /*Pass array element fo fun */ getch{ } ; } void display(int n) { printf (“\t%d”, n ) ; } Output:     The content of array is 100      20       40       15 3 /* Program to read 10 numbers from keyboard to store these num into array and then c...

Object Oriented Programming

Object Oriented Programming Programming paradigm that represents the concept of "objects" that have data fields (attributes that describe the object) and associated procedures known as methods Programming methodology based on objects, instead of just functions and procedures Focuses on data rather than process As individual objects can be modified without affecting other aspects of the program, it is easier for programmers to structure and organize software programs Easier to update and change programs written in object-oriented languages Simula was the first object oriented programming language Eg: C++, Java, etc. Features of OOPS Objects Referred as instance of class Basic run-time entities in an object-oriented system a person, a place, a bank account, a table of data, etc can be an object They occupy space in memory that keeps its state  Each object contains data and code to manipulate the data  Classes Blue print or prototype  which ...

Recursive Function in C programming

             If a statement within the body of a function calls the same function, the function is called recursive function. Actually, recursion is a process by which a function calls itself repeatedly until some specified condition has been satisfied. This process is used for repetitive computations in which each action is stated in term of previous result. Many iterative or repetitive problems can be written in this form.                To solve a problem using recursive method, two conditions must be satisfied. They are: 1)       Problem could be written or defined in term of its previous result. 2)       Problem statement must include a stopping condition. /*   An example of recursive function to calculate factorial of a number.*/    #include<stdio.h>    #include<conio.h...