accept the noun and the output of plural c++

C++
noun = getnoun();

// case a/b?
if (lastletterof(noun)=='y')
{ 
   if (isconsonant(onebutlastletter(noun)) 
   {
      // case a!
      plural = noun - lastletter;
      plural = plural + "ies" 
   }
   else
   {
      // case b!
      plural = noun + "s" 
   }
}
else 
{
    // noun is not case not a or b, so test for c, d.
}
output plural;

<div class="open_grepper_editor" title="Edit & Save To Grepper"></div>
       
       
Source

Also in C++: