Discover
Questions library
Collections library
Find online teacher
login
Discover
questions library
Find online teacher
login
Popular searches:
if-else
class-diagram
Polymorphism
flowchart
Home
Questions
Questions
Study lists
Kasim Kamal Questions
290 Questions
So long as the string is not const (§ 2.4, p. 59), we can assign a new value to the character that the subscript operator returns. For example, we can capitalize the first letter as follows
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
356
The following example uses the subscript operator to print the first character in a string
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
149
To convert the whole string we need to call toupper on each character and put the result back in that character
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
123
As a somewhat more complicated example, we’ll use a range for and the ispunct function to count the number of punctuation characters in a string
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
443
A string represents a sequence of characters, so we can use a string as the expression in a range for. As a simple example, we can use a range for to print each character from a string on its own line of output
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
151
When we mix strings and string or character literals, at least one operand to each + operator must be of string type
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
162
Because we can use these literals where a string is expected, we can rewrite the previous program as follows
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
117
The compound assignment operator (+=) (§ 1.4.1, p. 12) appends the right-hand operand to the lefthand string
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
373
In the case of strings, we can assign one string object to another
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
148
As an example, consider the following strings
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
150
The size member returns the length of a string (i.e., the number of characters in it). We can use size to print only lines longer than 80 characters
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
152
We can revise the previous program to only print lines that are not empty
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
111
We can rewrite the previous program that wrote one word per line to write a line at a time instead
C++ programming
2022-07-04
Answers
30
Question
40
Followers
30
0
1
144
Total:
290
Previous
4
5
6
7
8
Next
Go