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.

382 Day 10<br />

Incremental Search<br />

You can use the <strong>in</strong>cremental search option to quickly f<strong>in</strong>d a short series of characters. To start<br />

an <strong>in</strong>cremental search, choose Search | Incremental Search from the ma<strong>in</strong> menu or press<br />

Ctrl+E on the keyboard. To understand how the <strong>in</strong>cremental search works, it is easiest to do<br />

an exercise. Do the follow<strong>in</strong>g:<br />

1. Create a new text file from the Object Repository. (It doesn’t matter whether you<br />

currently have a project open.)<br />

2. Type the follow<strong>in</strong>g text:<br />

Learn<strong>in</strong>g to write W<strong>in</strong>dows<br />

programs a bit at a time<br />

is not so bad. Isn’t it<br />

time you got back to work?<br />

3. Move the cursor back to the top of the file (Ctrl+Home).<br />

4. Press Ctrl+E to start the <strong>in</strong>cremental search. You will be search<strong>in</strong>g for the word<br />

back. Note that the Code Editor status bar says Search<strong>in</strong>g for:.<br />

5. Type a b on the keyboard. The letter b <strong>in</strong> the word bit is highlighted. Hmmm…<br />

that’s not what you are look<strong>in</strong>g for.<br />

6. Now type an a on the keyboard. The next occurrence of ba is found, this time <strong>in</strong><br />

the word bad. That’s still not what you are look<strong>in</strong>g for.<br />

7. Type a c on the keyboard. The letters bac <strong>in</strong> the word back are highlighted. Now<br />

type a k. The Code Editor status bar now says Search<strong>in</strong>g for: back and the word<br />

back is highlighted. Congratulations, you found what you were look<strong>in</strong>g for!<br />

8. Press Esc (or Enter) on the keyboard to stop the <strong>in</strong>cremental search. Close the text<br />

file without sav<strong>in</strong>g it.<br />

That’s all there is to it. The <strong>in</strong>cremental search is handy when you’re search<strong>in</strong>g for short<br />

amounts of text.<br />

TIP<br />

If you make a mistake when typ<strong>in</strong>g <strong>in</strong> the characters while do<strong>in</strong>g an<br />

<strong>in</strong>cremental search, you can use the Backspace key to remove the last<br />

character typed from the search str<strong>in</strong>g.<br />

F<strong>in</strong>d<strong>in</strong>g Match<strong>in</strong>g Braces<br />

As you have seen, <strong>C++</strong> code can often get pretty convoluted when you start nest<strong>in</strong>g if<br />

statements, if-else pairs, and so on. To tell the truth, it’s easy to get lost. The Code Editor<br />

has a feature to help you f<strong>in</strong>d a brace that matches the brace the cursor is currently on. To

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

Saved successfully!

Ooh no, something went wrong!