Introduction to Programming
Remember your last visit to the super market. You might have purchased many items. What did you do after picking all the items and putting them into the carriage? Probably you met with the billing clerk to make the payment. Have you observed his way of preparing the bill? He picks the items one by one and enters something into the computer repeating the same task for all the items.
Within a count of few minutes or even may be within few seconds he gives the bill , you pay and come out carrying all the required things. So what made him to process the bill so fast? It is nothing but the “program” running in the computer’s memory. If you want to become a billing clerk, then what is needed is to just learn the method to use the program that helps in the billing the items.
Stop, don’t think in that way. You should dream something high! To design a program that helps the billing clerks to prepare the bill fast and in a most efficient way.
By and large computers are used either to run the designed programs or to design the program itself. As an upcoming programmer you are going to use the computer to design the programs. That should be your main dream and aim. Keeping that in mind, let us see “what is program?”
Definition: A program, strictly, a computer program is a collection of coded instructions to direct a computer to perform a desired set of operations. So, coding the instructions to make a program is an art. This art of making or designing a program is called programming. The person who writes such programs is called programmer.
Another definition of program:
Algorithm + Data Structure = Program
Definition : A program can be defined as the combination or clubbing of algorithm and data structure together into single unit. Here the algorithm refers to the procedure containing primitive steps to solve a particular task. A primitive step implies an easily understandable one. Data structure refer to the modeling of the required data to solve the task.
A programmer can design the program as per the customer's needs. The customer's need is collected as problem . The problem is analyzed to arrived at a solution. This solution provided using certain tools is called program. Whenever a problem arises , the programmer can design a program. The designed program can also be used to solve some related problems with the little modification. Changes is the nature! The new demands, requirements , etc. rise as the time passes. The programmer should react properly to these and should come out with a new solution from the existing solutions. Such existing solutions along with the new solution frame a program library. Now, let us see " what is program library?"
Definition: A library , a store or collection of computer programs is called program library . Each and every program in the library is designed to solve a certain type of problem.
What is canned program?
Definition: A program in a library of computer programs is called canned program. Existence of libraries of programs that are easy to use and designed to solve very general problems is important. The Turbo C compiler, you are going to learn, is the best example that contains many canned programs.
Turbo C compiler container many small programs in the form of built-in-functions contained in header tiles. With the help of such canned programs you can become a very good programmer. So, you should practice using such canned programs. Such canned programs are designed and added to the library. The canned programs are established and maintained by various computer manufacturers and centers.
For example, you will use a function scanf ( ) to read the input for almost all the programs you write and learn throughout the learning of this course. Similarly, you will use printf ( ) to display the messages and values or data on the output screen. Using such library functions or canned programs you build your own programs to solve general purpose or system-oriented problems. These two functions are canned in a header file “stdio.h”.
The C language that you are learning, contains nearly 27 such header files to design a program. All the header files inclusively contain hundreds of built-in functions. The header file “stdio.h” contains 56 built-in functions to solve many problems related to input and output operations. The following list provides a rough idea of number of built-in functions available in C:
“stdio.h” - 56, “conio.h”- 29,
“stdlib.h” - 42, “string.h” - 37,
“math.h” - 30, “ctype.h” - 17, etc.