Wyo C++ - Ch. 6 Notes

Objective #1: Understand C++ strings.

Objective #2: Use string objects.

at the top of your program and make sure that the apstring.h header file is located in the same folder as your source file. At home, you can download the apstring.h file as well as other AP class files from the AP Computer Science Web site. You should use the compiler directive,

to include the apstring.h file when working in the Wyo computer lab.

This syntax is similar to Visual Basic syntax such as:

where txtUserInput is a text box object and SetFocus is a method. However, in C++, you must type the empty parentheses.

Objective #3: Use the output operator ( << ) for console output.

which would cause the string literal "Hello world" to appear on the screen.

Objective #4: Use the input operator ( >>) for console input.

sets the width of the field allocated for the variable, billGatesWealth, to a 10 characters.

Objective #5: Be familiar with built-in C++ character arrays but appreciate that it is wiser and more efficient to use a string class (such as apstring).

In order to use the strcpy function within your program, you must use the following compiler directive at the top of your program.