![]() |
#2
rjsp2013-03-11 13:35
|

#include<iostream>
#include<string>
using namespace::std;
string make_plural(size_t ctr, const string &word, const string &ending "s"){
return(ctr==1)?word:word+ending;
}
int main(){
cout<<"Singular versior"<<make_plural(1,"success","es")<<
"\t\tplural version:"
<<make_plural(0,"success","es")<<endl
<<"Singular version:"<<make_plural(1,"failue")
<<"\t\tplural version:"
<<make_plural(0,"failuue")<<endl;
return 0;
}
#include<string>
using namespace::std;
string make_plural(size_t ctr, const string &word, const string &ending "s"){
return(ctr==1)?word:word+ending;
}
int main(){
cout<<"Singular versior"<<make_plural(1,"success","es")<<
"\t\tplural version:"
<<make_plural(0,"success","es")<<endl
<<"Singular version:"<<make_plural(1,"failue")
<<"\t\tplural version:"
<<make_plural(0,"failuue")<<endl;
return 0;
}