File tree 1 file changed +35
-35
lines changed
1 file changed +35
-35
lines changed Original file line number Diff line number Diff line change 7
7
8
8
void foo (String x)
9
9
{
10
- std::cout << x << std::endl;
10
+ std::cout << x << std::endl;
11
11
}
12
12
13
13
void bar (const String& x)
14
14
{
15
- std::cout << x.c_str () << std::endl;
15
+ std::cout << x.c_str () << std::endl;
16
16
}
17
17
18
18
String baz ()
19
19
{
20
- String ret (" world" );
21
- return ret;
20
+ String ret (" world" );
21
+ return ret;
22
22
}
23
23
24
24
int main ()
25
25
{
26
- char text[] = " world" ;
26
+ char text[] = " world" ;
27
27
28
- String s0;
29
- String s1 (" hello" );
30
- String s2 (std::move (s0));
31
- String s3 = s1;
32
- String s4 (text);
33
- s2 = s1;
28
+ String s0;
29
+ String s1 (" hello" );
30
+ String s2 (std::move (s0));
31
+ String s3 = s1;
32
+ String s4 (text);
33
+ s2 = s1;
34
34
35
- if (s2 == s1)
36
- std::cout << " s2 == s1" << std::endl;
35
+ if (s2 == s1)
36
+ std::cout << " s2 == s1" << std::endl;
37
37
38
- foo (s1);
39
- bar (s1);
40
- foo (" temporary" );
41
- bar (" temporary" );
42
- String s5 = baz ();
38
+ foo (s1);
39
+ bar (s1);
40
+ foo (" temporary" );
41
+ bar (" temporary" );
42
+ String s5 = baz ();
43
43
44
- std::vector<String> svec;
45
- // svec.push_back(s0);
46
- svec.push_back (s1);
47
- svec.push_back (s2);
48
- svec.push_back (s3);
49
- svec.push_back (s4);
50
- svec.push_back (baz ());
51
- svec.push_back (" good job" );
44
+ std::vector<String> svec;
45
+ // svec.push_back(s0);
46
+ svec.push_back (s1);
47
+ svec.push_back (s2);
48
+ svec.push_back (s3);
49
+ svec.push_back (s4);
50
+ svec.push_back (baz ());
51
+ svec.push_back (" good job" );
52
52
53
- for (const auto &s : svec) {
54
- std::cout << s << std::endl;
55
- }
53
+ for (const auto &s : svec) {
54
+ std::cout << s << std::endl;
55
+ }
56
56
57
- std::cout << " Input a string: " ;
58
- String s6;
59
- std::cin >> s6;
60
- std::cout << s6 << std::endl;
57
+ std::cout << " Input a string: " ;
58
+ String s6;
59
+ std::cin >> s6;
60
+ std::cout << s6 << std::endl;
61
61
62
- if (s6 > s1)
63
- std::cout << " s6 > s1" << std::endl;
62
+ if (s6 > s1)
63
+ std::cout << " s6 > s1" << std::endl;
64
64
}
You can’t perform that action at this time.
0 commit comments