C++ Chapter 4 Strings Review

Card Set Information

C++ Chapter 4 Strings Review
2012-12-13 12:25:09
chapter review strings string

Review for C++ Chapter 4: Strings
Show Answers:

  1. How long can a C++ string be?
    as long as you need it to be
  2. True/False: String literals appear between " " and character literals appear between ' '.
    True "hello or 'h' single character
  3. What compiler directive(s) are needed with strings?
    • #include <string>
    • using std::string;
  4. What function flushes out the input stream?
    cin.ignore(80, '\n');
  5. What does cin.ignore(80,'\n'); do?
    It will remove up to 80 characters or until it finds a '\n'.
  6. When should we use cin.ignore(80,'\n');?
    After cin >> ... for numeric input
  7. What isĀ (>>) called?
    the extraction operator (>>)
  8. What is (<<) called?
    the insertion operator (<<)
  9. What does the format option showpoint do?
    displays decimal point and zeroes
  10. What does the format option showpos do?
    displays + before positive values
  11. What does the format option scientific do?
    floating point numbers in E notation
  12. What does the format option fixed do?
    float point numbers in ordinary notation
  13. What compiler directive(s) is needed for setprecision and setw?
    #include <iomanip>
  14. Setw is used to set the number of digits that will be displayed, also known as the...
    field width
  15. What function is used to input strings?
    • string address;
    • getline(cin, address);
  16. A class is a generic definition for a(n)...
  17. Objects hold ____ and __________/_________.
    data and operations/functions