Answer the following questions true (T) or false (F)
1. The C-string library function strcmp compares two strings for equal length.
2. To get a complete line of 70 or so character into a C-string is as simple as declaring a long enough C-string and then using the >> operator to extract the line from the input.
1. False
Explanation: This library function compares the first characters of the two strings with each other. In strcmp(s1, s2) if the first character of s1 is less than the first character of s2, then strcmp returns a result > 0 The reverse yields a value < 0..If characters are equal, the successive characters are examined. If the end of the strings is reached at the same index, the strings are equal, and strcmp returns 0 .
2. False
Explanation: This will lose the leading spaces, then get the first non-blank string entered at the keyboard. To do this task, use the cin member function getline. This function takes two arguments, a C-string and an integer count of the number of characters that you want in your C-string plus one more for the null terminator.
You might also like to view...
Which of the following is a characteristic of wet pipe fire suppressions systems?
A) Water held back by a clapper B) Always contains water C) Air blows out of a pipe; the water flows D) Preferred for computer installations
The ____ category of the Insert panel is used to draw and insert tables, layers, div tags, and frames.
A. Layout B. Common C. Text D. HTML
___________________ is a rewritten version of HTML using XML developed in 2000.
Fill in the blank(s) with the appropriate word(s).
Linked lists of items are commonly implemented by
A) using an array to hold list items. B) using a function to compute the link to the next item. C) using a class template to represent list items. D) using a structure containing an item and a pointer to the structure type. E) None of the above