Overviews of Computers and Programming in C

Author Adhitya - -
Home » , » Overviews of Computers and Programming in C



Overviews of Computers and Programming in C
In developed countries, life in the twenty-first century is conducted in a veritable sea of computers. From the coffeepot that turns itself on to brew your morning coffee to the microwave that cooks your breakfast to the automobile that yon drive to work to the automated teller machine you stop by for cash, virtually every aspect of your life depends on computers. These machines which receive, store, process, and output information can deal with data of all kinds: numbers, text, images, graphics, and sound, to name a few.
The computer program's role in this technology is essential; without a list of instructions to follow, the computer is virtually useless. Programming languages allow us to write those programs and thus to communicate with computers.
You are about to begin the study of computer science using one of the most versatile programming languages available today: the C language. This chapter introduces you to the computer and its components and to the major categories of programming languages. 11 discusses how C programs are processed by a computer. It also describes a systematic approach to solving programming problems called tin-software development method and shows you how to apply it.

1.1 Electronic Computers Then and Now

In our everyday life, we come in contact with computers frequently, .some of as using computers for creating presentations and other documents, tabulating data in spread¬sheets, or even having studied programming in high school. But it wasn't always this way. Not so long ago, most people considered computers to be mysterious devices whose secrets were known only by a few computer wizards.
The first electronic computer was built in the late 1930s bv Dr. John Atanasoff and Clifford Berrv at Iowa State University. Atanasoff designed his computer to assist graduate students in nuclear physics with their mathematical computations.
The first large-scale, general-purpose electronic digital computer, called the EN I AC, was completed in 1946 at the University of Pennsylvania with funding from the U.S. Army. Weighing 30 tons and occupying a 30-by-50-foot space, the ENIAC was used to compute bill lis tics tables, predict the weather, and make atomic energy calculations.
These earlv computers used vacuum tubes as their basic electronic component. Technological advances in the design and manufacture of electronic components led to new generations of computers that were considerably smaller, faster, and less expensive than previous ones.

1.2 Computer Hardware
Despite significant variations in cost, size, and capabilities, modern computers resemble one another in many basic ways. Essentially, most consist of the following components:
Main memory
Secondary memory, which includes storage devices such as hard dusks. CDs,
DVDs, and flash drives
Central processing unit
Input devices, such as keyboards. mouses, touch pads, scanners, joysticks
Output devices, such as monitors, printers, and speakers

1.3 Computer Software
In the previous section, we surveyed the components of a computer system, compo¬nents referred to collectively as hardware. We also studied the fundamental opera¬tions that allow a computer to accomplish tasks: repeated fetching and execution of instructions. In this section we focus on these all-important lists of instructions called computer programs or computer software. We will consider first the software that makes the hardware friendly to the user. We will then look at the various levels of computer languages in which software is written and at the process of creating and running a new program.
Operating System
The collection of computer programs that control the interaction of the user and the computer hardware is called the operating system (OS). The operating sys¬tem of a computer is often compared to the conductor of an orchestra, for it is the software that is responsible for directing all computer operations and managing all computer resources. Usually part of the operating system is stored permanently in a read-only memorv (ROM) chip so that it is available as soon as the computer is turned on. A computer can look at the values in read-only memory, but can¬not write new values to the chip. The ROM-based portion of the OS contains the instructions necessary for loading into memory the rest of the operating system code, which typically resides on a dusk. Loading the operating system into memory is called hooting the computer.
Application Software
Application programs are developed to assist a computer user in accomplishing specific tasks. For example, a word-processing application such as Microsoft Word or OpenOffice.org Writer helps to create a document, a spreadsheet application such as Microsoft Office Excel helps to automate tedious numerical calculations and to generate charts that depict data, and a database management application such as Microsoft Office Access or BASE assists in data storage and quick keyword-based access to large collections of records.
Computer users typically purchase application software on CDs or by down¬loading files from the Internet and install the software by copying the programs to the bard disk. When buying software, you must always check that the program vou are purchasing is compatible with both the operating system and the computer hardware you plan to use. We have already discussed some of the differences among operating systems; now we will investigate the different languages understood by different processors.
Computer Languages
Developing new software requires writing lists of instructions for a computer to execute. However, software developers rarely write in the language directly under¬stood by a computer, since this machine language is a collection of binary numbers. Another drawback of machine language is that it i.\s not standardized: There is s a different machine language for every type of CPU. This same drawback also applies.


1.4   The Software Development Method
Programming is a problem-solving activity. If you are a good problem solver, you have the potential to become a good programmer. Therefore, one goal of this book is to help you improve your problem-solving ability. Problem-solving methods are covered in many subject areas. Business students learn to solve problems with a systems approach while engineering and science students use the engineering and scientific method. Programmers use the software development method.

1.5    Applying the Software Development Method
Throughout this book, we use the first five steps of the software development method to solve programming problems. These example problems, presented as Case Studies. begin with a problem statement As part of the problem analysis, we identify the data requirements for the problem, indicating the problem inputs and the desired outputs. Next, we design and refine the initial algorithm. Finally, we implement the algorithm as a C program. We also provide a sample run of the pro¬gram and discuss how to test the program.
We walk you through a sample case study next. This example includes a running commentary on the process, which you can use as a model in solving other problems.


Chapter Review
1.  The basic coponents of a computer are main memory and secondary storag the CPU, and input and output devices.
2.     All data manipulated by a computer are represented digitally, as base 2 numbers  composed of strings of the digits 0 and 1.
3.   Main memory is organized into individual storage locations called memory cells.
■      Each memory cell has a unique address.
■      A memory cell is a collection of bytes; a byte is a collection of 8 hits.
■      A memory cell is never empty, hut its initial contents may he meaningless to your program.
■     The current contents of a memory cell are destroyed whenever new infor¬mation is stored in that cell.
■      Programs must be loaded into the memory of the computer before they can be executed.
■      Data cannot be manipulated by the computer until the)- are first stored in memory.
4.   Information in secondary storage is organized into files: program files and data files. Secondary storage provides a low-cost means of storing large quantities of information in semipermanent form.
5.  A CPU runs a computer program by repeatedly fetching and executing simple machine-code instructions.
6.  Connecting computers in networks allows sharing of resources—local resources on LANs and worldwide resources on a WAN such as the Internet
7.  Programming languages range from machine language (meaningful to a com¬puter) to high-level language (meaningful to a programmer).
8.  Several system programs are used to prepare a high-level language program for execution. An editor enters a high-level language program into a file. A compiler translates a high-level language program (the source program) into machine language (the object program). The linker links thus object program to other object files, creating an executable file, and the loader loads the exe¬cutable file into memory. All of these programs are combined in an integrated development environment (IDE).