Teach Yourself Borland C++ Builder in 14 days.pdf
(
4788 KB
)
Pobierz
Teach Yourself Borland C++ in 14 Days
At A Glance
1
W
EEK
1
1
2
3
4
At a Glance
In Week 1 you will get a start on learning how to write Windows
programs in C++. The C++ language is not an easy language to learn. It
is, however, the standard programming language in many corporations
and governments around the world. Learning C++ might not be the
easiest task you could attempt to tackle, but it should be very rewarding,
both intellectually, and, eventually, monetarily.
Your first four days will be spent learning about the basics of the C++
language. As you work through the first four chapters, you will write
simple test programs, each of which will help you solidify a particular
feature of the C++ language. I warn you, though, that these programs
will probably not be the type of program that you purchased C++Builder
to write. The test programs for the first four days will be console
applications. These programs work just like DOS programs. They won’t
5
6
7
2
Week 1
have any flash or glitter. You probably won’t be terribly impressed. These programs will,
however, help to teach you the basics of C++, and that is what the first four days of this book
are about.
Starting on Day 5 you’ll begin to learn about some of the things that make the visual
programming aspect of C++Builder the great tool that it is. We will talk about frameworks
and what a framework means to you as a Windows programmer. On Day 5 you will build
a simple test program using C++Builder’s visual programming tools. After that we will spend
a couple days going over the C++Builder IDE so that you can become familiar with how the
entire C++Builder IDE works together to make your programming tasks easier. This is where
things start to get more interesting. You will get an opportunity to write some working
Windows programs in the last part of this first week. So, with that in mind, let’s get to it.
Getting Your Feet Wet
3
Week
1
1
Day
1
Getting Your Feet Wet
by Kent Reisdorph
Congratulations—you’ve chosen one of today’s hottest new programming
tools! Before you can jump into using all of what C++Builder has to offer,
though, you’ll need to learn a little about C++ first. In this chapter you will find
n
A quick tour of C++Builder
n
Information about how to write a Win32 console-mode application
n
An introduction to the C++ language
n
Facts about C++ variables and data types
n
Information about functions in C++ (including the
main()
function)
n
A discussion of arrays
4
Day 1
What Is C++Builder?
By now you know that C++Builder is Borland’s hot new rapid application development
(RAD) product for writing C++ applications. With C++Builder you can write C++ Windows
programs more quickly and more easily than was ever possible before. You can create Win32
console applications or Win32 GUI (graphical user interface) programs. When creating
Win32 GUI applications with C++Builder, you have all the power of C++ wrapped up in a
RAD environment. What this means is that you can create the user interface to a program
(the
user interface
means the menus, dialog boxes, main window, and so on) using drag-and-
drop techniques for true rapid application development. You can also drop OCX controls
on forms to create specialized programs such as Web browsers in a matter of minutes.
C++Builder gives you all of this, but you don’t sacrifice program execution speed because you
still have the power that the C++ language offers you.
I can hear you saying, “This is going to be so cool!” And guess what? You’re right! But before
you go slobbering all over yourself with anticipation, I also need to point out that the C++
language is not an easy one to master. I don’t want you to think that you can buy a program
like C++Builder and be a master Windows programmer overnight. It takes a great deal of
work to be a good Windows programmer. C++Builder does a great job of hiding some of the
low-level details that make up the guts of a Windows program, but it cannot write programs
for you. In the end, you must still be a programmer, and that means you have to learn
programming. That can be a long, uphill journey some days. The good news is that
C++Builder can make your trek fairly painless and even fun. Yes, you can work and have fun
doing it!
So roll up your sleeves and get your hiking shoes on. C++Builder
is
cool, so have fun.
A Quick Look at the C++Builder IDE
This section contains a quick look at the C++Builder IDE. We’ll give the IDE a once-over
here, and we’ll examine it in more detail on Day 6, “The C++Builder IDE Explored: Projects
and Forms.” Because you are tackling Windows programming, I’ll assume you are advanced
enough to have figured out how to start C++Builder. When you first start the program, you
are presented with both a blank form and the IDE, as shown in Figure 1.1.
The C++Builder IDE (which stands for
integrated development environment
) is divided into
three parts. The top window might be considered the main window. It contains the speedbar
on the left and the Component Palette on the right. The speedbar gives you one-click access
to tasks like opening, saving, and compiling projects. The Component Palette contains a
wide array of components that you can drop onto your forms. (
Components
are things like
text labels, edit controls, list boxes, buttons, and the like.) For convenience, the components
Getting Your Feet Wet
5
are divided into groups. Did you notice the tabs along the top of the Component Palette? Go
ahead and click on the tabs to explore the different components available to you. To place
a component on your form, you simply click the component’s button in the Component
Palette and then click on your form where you want the component to appear. Don’t worry
about the fact that you don’t yet know how to use components. We’ll get to that in due time.
When you are done exploring, click on the tab labeled Standard, because you’ll need it in a
moment.
1
Figure 1.1.
The C++Builder
IDE and the initial
blank form.
N
EW
T
ERM
A c
omponent
is a self-contained piece of binary software that performs some specific
predefined task, such as a text label, an edit control, or a list box.
Below the speedbar and Component Palette and glued to the left side of the screen is the
Object Inspector. It is through the Object Inspector that you modify a component’s
properties and events. You will use the Object Inspector constantly as you work with
C++Builder. The Object Inspector has one or two tabs, depending on the component
currently selected. It always has a Properties tab. A component’s
properties
control how the
component operates. For example, changing the
Color
property of a component will change
the background color of that component. The list of available properties varies from
component to component, although components usually have several common elements
(
Width
and
Height
properties, for instance).
Plik z chomika:
nemezisss
Inne pliki z tego folderu:
Teach Yourself Borland C++ Builder in 14 days.pdf
(4788 KB)
Symfonia C++.pdf
(70695 KB)
Borland C++ Builder 6_Book.pdf
(12189 KB)
Inne foldery tego chomika:
algebra
Analiza matematyczna
angielskie
kryptografia
Zgłoś jeśli
naruszono regulamin