C++ Pocket Reference (Pocket Referemce)
|
| List Price: | £7.50 |
| Price: | £4.48 & eligible for FREE Super Saver Delivery. Details |
Availability: Usually dispatched within 1 to 2 days
Dispatched from and sold by Amazon.co.uk
38 new or used available from £2.33
Average customer review:Product Description
C++ is a complex language with many subtle facets. This is especially true when it comes to object-oriented and template programming. The "C++ Pocket Reference" is a memory aid for C++ programmers, enabling them to quickly look up usage and syntax for unfamiliar and infrequently used aspects of the language. The book's small size makes it easy to carry about, ensuring that it will always be at-hand when needed. In the book, you will find: information on C++ types and type conversions; syntax for C++ statements and preprocessor directives; help declaring and defining classes, and managing inheritance; information on declarations, storage classes, arrays, pointers, strings, and expressions; and refreshers on key concepts of C++ such as namespaces and scope. It should be useful to Java and C programmers making the transition to C++, or who find themselves occasionally programming in C++. The three languages are often confusingly similar. This book enables programmers familiar with C or Java to quickly come up to speed on how a particular construct or concept is implemented in C++. Together with its companion "STL Pocket Reference, the C++ Pocket Reference" forms one of the most concise, easily-carried, quick-references to the C++ language available.
Product Details
- Amazon Sales Rank: #23029 in Books
- Published on: 2003-05
- Original language: English
- Number of items: 1
- Binding: Paperback
- 144 pages
Editorial Reviews
About the Author
Kyle Loudon is a software developer at Yahoo! where he leads a group doing user interface development. Some of Kyle's experiences prior to joining Yahoo! include working on the user interface for the original Apple iPod, writing software for various other mobile devices, and leading the user interface group at Jeppesen Dataplan (a Boeing company) in the development of a flight planning system used by airlines around the world. He also spent a small amount of time with IBM in the early 1990s. For several years, he has taught object-oriented programming part-time at the University of California, Santa Cruz while working as a software developer in Silicon Valley.
Kyle received a B.S. in Computer Science from Purdue University in 1992 with a minor in French, and was elected there to the Phi Beta Kappa honor society. He has also done some advanced education in Computer Science at Stanford University.
Excerpted from C++ Pocket Reference by Kyle Loudon. Copyright © 2003. Reprinted by permission. All rights reserved.
Statements
There are many types of statements in C++. Some simply evaluate expressions, while others change the order in which statements are executed in the future.
Expression Statements
An expression statement is an expression followed by a single semicolon (;). Expression statements cause an expression to be evaluated. Side effects, such as an assignment to a variable, are completed before the next statement is executed. For example:
a = 10;
Null Statements
A null statement is written as a semicolon (;). Null statements are useful when the syntax of C++ requires a statement but you don’t need anything performed. For example: void spin(int n)
{
for (int i = 0; i > ch;
}
This repeats a block as long as ch is 'y'. The body of the loop is never executed if the expression at the top of the loop is false when the loop is first encountered.
do
A do loop repeats a statement or block as long as an expression evaluated at the bottom of the loop is true. For example:char ch;
do
{
// Do something to be repeated.
...
cout > ch;
} while (ch == 'y');
This repeats a block as long as ch is 'y'; however, the body of the loop is executed at least once because the condition for looping is evaluated at the end of each iteration.
for
A for loop is similar to a while loop, but additional mechanisms are provided for initializing the loop and making adjustments after each of its iterations. For example:
// Prevent warnings in Visual C++.
#pragma warning(disable:4786)
typedef map IntStringMap;
IntStringMap m;
char s[4];
for (int i = 0; i < 10; i++)
{
s[0] = 'a' + i; s[1] = 'b' + i;
s[2] = 'c' + i; s[3] = '\0';
m.insert(IntStringMap::value_type(i,
string(s)));
}
The key to for loops is understanding the statements that go within the parentheses following the for keyword. The statement before the first semicolon is the statement executed to initialize the loop. Before each iteration, including the first, the expression between the two semicolons is evaluated. If the expression is true, the loop body is executed; otherwise, theloop terminates. After each iteration, the rightmost expression is evaluated, and the cycle is repeated. for loops can contain more complicated expressions as well. For example:
void upperString(char *t, const char *s)
{
for (; *s != '\0'; *(t++) = toupper(*(s++)))
;
*(t++) = '\0';
}
This function uses a for loop to translate string s to uppercase and copy it to t. The function assumes that storage has already been allocated for t. A null statement is used for initialization since s and t are already initialized when the function starts. A null statement is also used for the loop body.
NOTE
A name declared in a for initialization statement is visible until the end of the for loop.
Customer Reviews
Really useful
Great little book to keep next to you when coding, its not particularly extensive but as a reference to the languages core features its invaluable. Its also not too technical so its great for beginners or if you want an answer without getting bogged down in technical information.
Good book
A neat pocket reference. An easy and quick way to check both syntax and what it does.
Easy too use and informative.
In my opinion, a good book for beginners and such.



