回答編集履歴
3
微修正
answer
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
cout << str.front() << endl;
|
15
15
|
cout << str.c_str()[0] << endl;
|
16
16
|
cout << *str.c_str() << endl;
|
17
|
+
cout << str.data()[0] << endl;
|
18
|
+
cout << *str.data() << endl;
|
17
19
|
char c; str.copy(&c,1);
|
18
20
|
cout << c << endl;
|
19
21
|
}
|
2
微修正
answer
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
cout << str.front() << endl;
|
15
15
|
cout << str.c_str()[0] << endl;
|
16
16
|
cout << *str.c_str() << endl;
|
17
|
+
char c; str.copy(&c,1);
|
18
|
+
cout << c << endl;
|
17
19
|
}
|
18
20
|
```
|
19
21
|
|
1
微修正
answer
CHANGED
@@ -7,13 +7,13 @@
|
|
7
7
|
int main( ) {
|
8
8
|
string str("Perfect number") ;
|
9
9
|
|
10
|
-
cout << str[0]
|
10
|
+
cout << str[0] << endl;
|
11
|
-
cout << str.at(0)
|
11
|
+
cout << str.at(0) << endl;
|
12
|
-
cout << *str.begin()
|
12
|
+
cout << *str.begin() << endl;
|
13
|
-
cout << *begin(str)
|
13
|
+
cout << *begin(str) << endl;
|
14
|
-
cout << str.front()
|
14
|
+
cout << str.front() << endl;
|
15
|
-
|
16
|
-
|
15
|
+
cout << str.c_str()[0] << endl;
|
16
|
+
cout << *str.c_str() << endl;
|
17
17
|
}
|
18
18
|
```
|
19
19
|
|