Sie sind auf Seite 1von 2

Computer Programming

OBJECTIVES
To test the knowledge of the following topics, covered so far;
the activity of programming
the architecture of computers
using your compiler
recognizing syntax and logic errors
writing algorithms in plain English
integer and floating-point numbers
writing arithmetic expressions in C
appreciating the importance of comments and good code layout
defining and initializing variables and constants
recognizing the limitations of the int and double types
reading user input and displaying program output
changing the values of variables through assignment
writing simple programs that read numbers and text, process the input and display
the results
Becoming familiar with your computer
!ll modern computers offer their users an interface to their physical, electrical, and
digital systems" #our computer$s operating system provides fundamental services from
behind the scenes" ! large part of a computer$s work is simply storing and retrieving data
so that it can be available to use"
The operating system takes care of a lot of the filing work i"e" storing, moving and
remembering where things are" #ou interact with the operating system via a Graphic
User Interface (GUI), for example a windowing system using a pointing device like a
mouse, or a Command Line Interface, using only a keyboard and a single window"
Q. 1 !hat are "ome e#ample" of ta"$" you woul% tell the computer to %o &ia the
operating "y"tem interface' (li"t only four)
%perations like browsing the web and editing text in a word processor - most of the
things involve your operating system executing some program" The operating system
itself is a program which is running all the time" &t executes your instructions and, in turn,
it can run other programs"
&t is useful to think of a program as a se'uence of instructions" (oth executable
instructions and digital data can be represented as files, for example, on your hard drive"
(oth are se'uences of symbols, )ust like the letters that make up the words in this
*age + of ,
sentence" #our )ob as a programmer is of course to provide the instructions that operate
on the data"
#ou have already got some experience with the operating system to find a file" #ou will
locate math"h, an include file used by C" #ou have learned in lab- how to find a file on
your computer as well as the location of the include files"
Q. * !hat %i% you %o to fin% math.h' ./rite steps to locate math"h0
The program that you will be running to write computer programs is your text editor,
which is often part of an integrated compiler environment" #ou have already worked in
computer lab for total 1 hours .2 labs0 and you have learned how to start the editor"
Compiling an% running program" from within your %e&elopment en&ironment
3re'uently in these labs you have compiled various programs" (elow is a copy of a C
program that displays a drawing" Copy and paste it into your compiler$s editor, and from
there save it as art"cpp"
44 *rogram to 5isplay an $art$ drawing
6include 7iostream"h8
6include 7conio"h8
void main.0
9
clrscr.0;
cout77: ; ; :;
cout77: ; ; ; ; :;
cout77: ; ; ; ; :;
cout77: ; ; ; ; :;
cout77: ; ; ; ; :;
cout77: ; ; ; ; :;
cout77: ; ; :;
getch.0;
<
%nce you have typed in .or, in this case, pasted in0 a program, you need to compile it to
create an executable file" 3ind out the steps for your computer system, then go ahead and
compile art"cpp to an executable file"
Q. + ,e"cri-e what you %i%.
3inally, execute the program" %nce again, the steps depend on your computer system"
*age , of ,

Das könnte Ihnen auch gefallen