Answer the following questions true (T) or false (F)

1. To read a character at a time, or to write a character at a time, declare a character variable ch and write this:
cin >> ch;

2. Indexing for Standard string objects does not range check/


1. False
Explanation:
The problem with this code is that by default, cin>>ch discards whitespace. (this default behavior can be changed, but we have a different solution.) To read a character at a time, no matter what it is, even a space, use the member functions get. The get function is a member of cin’s class, and has a type char call-by-reference parameter.
2. True
Explanation: C++, and its libraries have been designed to be lean and efficient. C++ was designed so that programs do not pay for features they do not use. The price of this efficiency is that programmers are assumed to know what they are doing, and are allowed to hurt themselves. Index range checking is provided by the at() member function which we will study later.

Computer Science & Information Technology

You might also like to view...

Compare two Linux distributions. What tools do they share? Name some tools that are unique to one distribution.

What will be an ideal response?

Computer Science & Information Technology

When using the password data type, any information that a user enters will be displayed as a series of ____ or asterisks, protecting the information from prying eyes.

A. dashes B. dots C. ampersands D. plus signs

Computer Science & Information Technology

Field types in an OpenOffice Base database are defined in Design View of a table

Indicate whether the statement is true or false

Computer Science & Information Technology

When a form is edited, Access automatically saves all changes for the user

Indicate whether the statement is true or false

Computer Science & Information Technology