File tree Expand file tree Collapse file tree 1 file changed +35
-35
lines changed
Expand file tree Collapse file tree 1 file changed +35
-35
lines changed Original file line number Diff line number Diff line change 77
88void foo (String x)
99{
10- std::cout << x << std::endl;
10+ std::cout << x << std::endl;
1111}
1212
1313void bar (const String& x)
1414{
15- std::cout << x.c_str () << std::endl;
15+ std::cout << x.c_str () << std::endl;
1616}
1717
1818String baz ()
1919{
20- String ret (" world" );
21- return ret;
20+ String ret (" world" );
21+ return ret;
2222}
2323
2424int main ()
2525{
26- char text[] = " world" ;
26+ char text[] = " world" ;
2727
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;
3434
35- if (s2 == s1)
36- std::cout << " s2 == s1" << std::endl;
35+ if (s2 == s1)
36+ std::cout << " s2 == s1" << std::endl;
3737
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 ();
4343
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" );
5252
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+ }
5656
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;
6161
62- if (s6 > s1)
63- std::cout << " s6 > s1" << std::endl;
62+ if (s6 > s1)
63+ std::cout << " s6 > s1" << std::endl;
6464}
You can’t perform that action at this time.
0 commit comments