12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Gett<strong>in</strong>g Your Feet Wet<br />

but you need not be concerned about that right now. So, without further ado, let’s create<br />

Hello World as a W<strong>in</strong>32 console program with <strong>C++</strong>Builder.<br />

A W<strong>in</strong>32 console application is a 32-bit program that runs <strong>in</strong> a DOS box under<br />

W<strong>in</strong>dows 95 or W<strong>in</strong>dows NT.<br />

NEW TERM<br />

From the ma<strong>in</strong> menu, choose File | New. <strong>C++</strong>Builder displays the Object Repository.<br />

Curiously enough, the Object Repository’s title bar says New Items, but don’t be thrown by<br />

that. The Object Repository conta<strong>in</strong>s predef<strong>in</strong>ed projects, forms, dialog boxes, and other<br />

objects you can add to your applications or use to beg<strong>in</strong> a new project. I will discuss the Object<br />

Repository <strong>in</strong> detail on Day 9, “Creat<strong>in</strong>g Applications <strong>in</strong> <strong>C++</strong>Builder.” For now, click on the<br />

New tab <strong>in</strong> the Object Repository and double-click Console App to start a new console<br />

application project. <strong>C++</strong>Builder creates the project and displays the Code Editor so that you<br />

can enter code for the program. Figure 1.4 shows the Code Editor as it appears when start<strong>in</strong>g<br />

a new console-mode application.<br />

Figure 1.4.<br />

The <strong>C++</strong>Builder<br />

Code Editor w<strong>in</strong>dow.<br />

You will notice a couple of differences between the <strong>C++</strong>Builder IDE now and how it looked<br />

earlier when we created a GUI application. First, there is no Form Editor. That’s because a<br />

console application can’t display forms (well, that’s not completely true, but it’s accurate<br />

enough for this discussion). Also notice that the Object Inspector is blank. You can only place<br />

components on a form, so the Object Inspector is useless <strong>in</strong> a console application.<br />

TIP<br />

When writ<strong>in</strong>g console applications, you can close the Object Inspector<br />

to make more room for the Code Editor w<strong>in</strong>dow. Close the Object<br />

Inspector by click<strong>in</strong>g the Close button on the Object Inspector’s title<br />

bar. To br<strong>in</strong>g back the Object Inspector, press F11 or choose<br />

View | Object Inspector from the ma<strong>in</strong> menu.<br />

9<br />

1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!