Article View: comp.lang.misc
Article #2882Re: Printing plural forms.
From: Walter Bright
Date: Wed, 27 Feb 1991 18:02
Date: Wed, 27 Feb 1991 18:02
12 lines
987 bytes
987 bytes
In article <1991Feb19.104810.549@ZYX.SE> arndt@zyx.ZYX.SE (Arndt Jonasson) writes:
/We all have seen and, in various degrees, been irritated by texts such as:
/ 1 files were copied
/when it should have been:
/ 1 file was copied
/I'd like to know: when programming, how do you avoid such errors? Are
I've never discovered any magic way, other than brute force:
printf((n == 1) ? "%d file was copied\n" : "%d files were copied\n",n);
or:
printf("%d file%s copied\n",n,(n == 1) ? " was" : "s were");
Technical Details
Message-ID:
<273@nazgul.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!pilchuck!dataio!fnx!nazgul!brightReferences:
<1991Feb19.104810.549@ZYX.SE>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!pilchuck!dataio!fnx!nazgul!bright From: bright@nazgul.UUCP (Walter Bright) Newsgroups: comp.lang.misc Subject: Re: Printing plural forms. Message-ID: <273@nazgul.UUCP> Date: 27 Feb 91 18:02:05 GMT References: <1991Feb19.104810.549@ZYX.SE> Reply-To: bright@nazgul.UUCP (Walter Bright) Organization: Zortech, Seattle Lines: 12