Skip to content

Commit 4bc1138

Browse files
Mooophypezy
authored andcommitted
Update ex6_42.cpp
1 parent 5b3cd0a commit 4bc1138

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

ch06/ex6_42.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
//! @Alan
1+
//! @Yue Wang
22
//!
33
//! Exercise 6.42:
44
//! Give the second parameter of make_plural (§ 6.3.2, p. 224) a default
55
//! argument of 's'. Test your program by printing singular and plural
66
//! versions of the words success and failure.
7+
//!
78

89
#include <iostream>
910
#include <string>
10-
1111
using std::string; using std::cout; using std::endl;
1212

13-
1413
string make_plural(size_t ctr, const string &word, const string &ending = "s")
1514
{
1615
return (ctr > 1) ? word + ending : word;
1716
}
1817

1918
int main()
2019
{
21-
cout<<"singual: " << make_plural(1, "success") << " "
22-
<< make_plural(1, "failure") << endl;
23-
cout<<"plural : " << make_plural(2, "success") << " "
24-
<< make_plural(2, "failure") << endl;
20+
cout << "singual: " << make_plural(1, "success") << " " << make_plural(1, "failure") << endl;
21+
cout << "plural : " << make_plural(2, "success") << " " << make_plural(2, "failure") << endl;
22+
23+
return 0;
2524
}

0 commit comments

Comments
 (0)