Currently unavailable.
We don't know when or if this item will be back in stock.
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more

C++ Pocket Reference

4.3 out of 5 stars 24 customer reviews

See all 8 formats and editions Hide other formats and editions
Amazon Price
New from Used from
Kindle Edition
--This text refers to the Paperback edition.
Currently unavailable. We don't know when or if this item will be back in stock.
Customers also viewed these available items
click to open popover


What other items do customers buy after viewing this item?

Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.

  • Apple
  • Android
  • Windows Phone

To get the free app, enter your mobile phone number.



60 Kindle Books for £1
Browse our selection of Kindle Books discounted to £1 each. Learn more

Product details

  • School & Library Binding
  • Publisher: San Val (May 2003)
  • Language: English
  • ISBN-10: 0613912373
  • ISBN-13: 978-0613912372
  • Average Customer Review: 4.3 out of 5 stars 24 customer reviews
  • Would you like to tell us about a lower price?
    If you are a seller for this product, would you like to suggest updates through seller support?

Product description

About the Author

Kyle Loudon is a software engineer at Matrix Semiconductor in Santa Clara, California, where he works with file systems and applications for memory chips. Prior to Matrix, Kyle developed platform software for embedded devices, including various wireless phones and the Apple iPod. He also led the graphical user interface group at Jeppesen Dataplan (now a part of Boeing), developed flight planning software, and created system software at IBM in the early 1990s. For the past several years, Kyle has taught object-oriented programming using C++ at the University of California, Santa Cruz Extension, and has worked with C++ since the beginning of its widespread use in 1990. Kyle is the author of Mastering Algorithms with C, also published by O'Reilly and Associates.

--This text refers to the Paperback edition.

Excerpt. © 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. --This text refers to the Paperback edition.


Customer reviews

Top customer reviews

on 20 April 2017
Format: Paperback|Verified Purchase
0Comment|Was this review helpful to you? Report abuse
on 31 July 2017
Format: Paperback|Verified Purchase
0Comment|Was this review helpful to you? Report abuse
on 19 September 2009
Format: Paperback
0Comment| 6 people found this helpful. Was this review helpful to you? Report abuse
on 9 January 2011
Format: Paperback
0Comment| 5 people found this helpful. Was this review helpful to you? Report abuse
on 15 February 2009
Format: Paperback
0Comment| 4 people found this helpful. Was this review helpful to you? Report abuse
on 1 March 2010
Format: Paperback
0Comment| 2 people found this helpful. Was this review helpful to you? Report abuse
on 11 June 2013
Format: Paperback|Verified Purchase
0Comment| 3 people found this helpful. Was this review helpful to you? Report abuse
on 26 April 2015
Format: Paperback|Verified Purchase
0Comment| One person found this helpful. Was this review helpful to you? Report abuse

Would you like to see more reviews about this item?

Where's My Stuff?

Delivery and Returns

Need Help?