AP Classes and String
Variables
(Download these classes, if you have not already done
so.)
The Advanced Placement Computer Science (APCS) Committee is the committee responsible for creating the APCS
Examination.
They have created a variety of C++ tools, based on the C++ standard,
for the beginning programmer.
One such tool, features the creation of an apstring data
type. The letters "ap" associated with
these tools let you know that they are not part of your current C++ compiler, but
were developed by the APCS Committee.
The AP* tool needed to use this new string variable is apstring.cpp, and this
new variable
is declared as being of type
apstring. Using
the type
apstring is similar to using int,
double, and char.
You must use #include "apstring.cpp"
to have access to this special
apstring data type. You must install the AP Classes in
the "include" directory of your software before using them.
A link to the AP Classes can be found on the C++ main (opening) page.
//sample program
#include <iostream.h>
#include "apstring.cpp"
int main(void)
{
apstring CrewName;
//declare variable
CrewName =
"Neelix";
//initialize variable
return 0;
}
|
The use of the
apstring class will eliminate all of the problems of
dealing with character string arrays that we have seen. With the
apstring class we can initialize string variables whenever
and wherever we wish and the computer will automatically
keep track of the length of the string. |
AP* is a
registered trademark of the College Entrance Examination Board,
which was not involved in the production of this web site.
|
|
Return to Topic Menu |
Computer Science Main Page |
MathBits.com |
Terms of Use
|