|
mcelraft
|
Friday, December
21, 2001 - 07:20 pm
there are many things you can do with your coputer, but none that is more
powerfull than programming. programming opens up the power of computer like
no other way. these serties of emails will help introduce people to
programming.
first off, what is programming exactly?
the answer is simple, a program is a series of written code that tells the
computer what to do. everything and i do mena everything on a computer is a
program. everything from the word prossesor you use to write reports to the
explorer window that is used to veiw your email.
programming allows a person to write their own programs, much like the ones
you use. there are many different programming languages, these include,
fortran, cobol, basic, perl, java and among others c++.
it is important to understand what kind of programs there are, applications
include, wordperfect, microsoft word and also games. many of these programs
are written in c++, so let's start there.
the bacis underlying structure of a program includes machine language, this
is represented in 1s and 0s. these ones and zeros represent letters or
numbers.
for example.
11010 represents the letter h for example, the numbers are easily read by
machines and hard for humans to comprehend.
that is where programming languages come in, they translate machine code
into something me and you can understand. an example of this is basic.
10 print "hello"
20 end
as you can see this is very easily understood by humans. line 10 prints
hello and line 20 ends the program. the words hello end up on the screen
when you run the program. for c++, however it is written differently as
such.
#include
int main
{
cout <<"hello\n";
return 0;
}
|
   
phillip mcelraft |
Friday, December
21, 2001 - 07:21 pm
as you can see, it is different with c++, when ran the program does the
same finction as the basic program. it prints the word hello on the screen.
now that you understand what a program is and what it does lets talk about
the underlyling structure of a program, first there are some terms you need
to know.
when you type in a program code, known as source code, which is notheing
more than the syntax or text of the program, you need to compile the code.
compiling is turning your text into an object file, which is afile that has
a function or job to do. there are many compilers for c++ and you will know
which compiler a source code uses by it's extention. an extention is just an
ending to the file name, for example, when you download a document, it
usually looks like this, mydocument.txt, the .txt stands for text. with a
picture it is like this, mypicture.bmp, which is a picture in bitmap form.
c++ uses the same idea, there are many different compilers out there, you
will know what kind of compiler to use by these extentions.
borland c++ .bc
borland c# for windows .bcc
microsoft .cl
djgpp .gxx
turbo c++ .tc
there are no difference in the use of your source files, just different
compilers use different extentions.
the next thing to know is what a linker is, a linker transforms an object
file into an executable program while a compiler produces an object file.
this is how a programming language works. it produces an executable program,
which runs the machine, like the aforemention hello program.
c++ is an object oriented language, it uses four types of object
oreintations.
1. escaputlation
2. data hiding
3. inheritence
4. polymorphism
escapulation and data hiding are self contained, well defined object files.
they are like tires on a car, you know it works, but do not need to know why
it works. escapulations takes out the need to know how something works and
does it for you.
inheritence is just as it sounds, something given from an ancester in this
case the old programming language c. c++ uses some of the same tools and
functions as c, seeing that c is it's father.
polymorphism uses defined functions to work and can take the role of many
other things. they are in essence objects that do the right thing at the
right time.
before we go furthur, there are two things you need to know before you
program and that is,
1. design the program before you write it
2. make sure you have clear goals for your program
programs are made to solve problems.
|