utility
|
cmd_head.c,
count_tokens.c,
cp_file.c,
errmsg.c,
file_opened.c,
find_line.c,
find_string.c,
fn_base.c,
fn_dir.c,
fn_ext.c,
fn_root.c,
gchoice.c,
gdata_line.c,
gdouble.c,
gfield.c,
gint.c,
gntoken.c,
graphics_ok.c,
gstring.c,
lock.c,
lower.c,
mat_multiply.c,
mat_transform.c,
mat_transpose.c,
mv_file.c,
new_extension.c,
nolead.c,
notrail.c,
ordinal.c,
pfield.c,
squish_blanks.c,
test.c,
unlock.c,
upper.c,
utility.h,
utility.make,
valchars.c,
vec_angle.c,
vec_crossprod.c,
vec_diff.c,
vec_dotprod.c,
vec_length.c,
vec_norm.c,
|
|
|
#include "utility.h"
#define MAX_KNOWN_NUMBER 20
char *ordinal(number,ordinal_string)
/*============================================================================*/
/* PURPOSE: TO CONVERT AN INTEGER INTO AN ORDINAL NUMBER STRING.
/* INPUTS:
/* NUMBER INTEGER TO CONVERT TO ORDINAL.
/* OUTPUTS:
/* ORDINAL_STRING ORDINAL NUMBER REPRESENTATION OF NUMBER.
/* FUNCTION VALUE ORDINAL NUMBER REPRESENTATION OF NUMBER.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 15 JANUARY 1993 MVG
*/
int number;
char ordinal_string[];
{
static char *ordinal_strings[30]={
"Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh",
"Eighth","Nineth","Tenth","Eleventh","Twelveth","Thirteenth","Fourteenth",
"Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth","Twentieth"};
if (number>MAX_KNOWN_NUMBER)
{
/* CRUDE, BETTER THAN NOTHING. */
sprintf(ordinal_string,"%d",number);
}
else strcpy(ordinal_string,ordinal_strings[number]);
return(ordinal_string);
}
|