Some Things about Strings

Some Things about Strings - Some Things about Strings We've...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Some Things about Strings We've seen how to use the C++ builtin int type. You can create an object n of type int though a declaration: int n; At any point in time, such an object has one value drawn from a large (but finite) set: some big negative integer , . .., -3, -2, -1, 0, 1, 2, 3, . .., some big positive integer . The language enables you to do certain operations with int s, among them: int k = 2 * 6; // create and initialize one int int m = k; // and another int n; // create an int with an unspecified value n = k + 3; // add ints and assign ints if (m == n) // compare ints with == ... The Standard C++ library enables additional operations: #include <iostream> std::cout << k; // write a sequence of characters representing // the value of an int std::cin >> k; // read a sequence of characters representing // the value of an int, and store that value // in an int variable C++ has a builtin type double , with similar operations (but not identical, of course, because double s have values drawn from a different set, and the detailed semantics (i.e., meaning) of operations like division, output, and input are not the same). The C++
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Some Things about Strings - Some Things about Strings We've...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online