Components of a Computer Program

Submitted by: Submitted by

Views: 355

Words: 415

Pages: 2

Category: Other Topics

Date Submitted: 09/28/2012 09:33 PM

Report This Essay

Components of a Computer Program

A computer program is step by step solution to particular problem written using a computer programming language. The syntax and semantics of the programming language helps us to write some of the very effective programs in solving tedious problems. A computer program accepts and stores input from user, processes the input to produce the output, and finally display the results for user. A computer program consists of following components

• Input Components

• Processing Logic

• Output Components

Let us describe these components in brief.

Input Components

Input Components of a program are used to accept and store the input parameters to used by the program to produce the output. The entities that store input parameters are know as variables.

Processing Logic

It is that part of the program that produces the required results. The programmer will write some functions used to process input values to produce results.

Output Components

These components are used to store the results and the display these results for the user as required. Various formatting techniques are provided in programming languages to make the output look well formed and attractive.

Basic Program Structure

The figure above shows the basic program structure. Various languages implements these components in different ways. C++ uses variables and functions to form these components. Functions help us in dividing our program into modules. Each function performs the required task. When we call these functions from the main function of a C++ program in the sequence shown in above figure, we get required results. Let us consider a simple C++ program that is used to accept two numbers, find their sum and then display the sum of two numbers.

The figure on the next page shows graphically how each component of a program interacts with other another component. Every C++ program has a main() function from where execution starts. This program has following...