blob: a2e1cca515519f2d791b37dfe39c9ac456bc0e97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <iostream>
/*
*
* 6.42
*
*
*/
std::string make_plural(size_t ctr,
const std::string &word,
const std::string &ending = "s"
) {
return (ctr > 1) ? word + ending : word;
}
int main () {
std::cout << make_plural(2, "Success", "es") << std::endl;
std::cout << make_plural(2, "Success") << std::endl;
std::cout << make_plural(2, "Failure") << std::endl;
return 0;
}
|