What’s Upword?
Let’s call a word an "upword" if its letters are alphabetically sorted, case-insensitively, left to right. By this definition, Begins
is an upword because B
comes before e
, which comes before g
, which comes before i
, which comes before n
, which comes before s
. So too is billow
(as ll
does not violate this definition), but test
is not because t
does not come before e
alphabetically.
Answer the below in upword.txt
.
Questions
-
(1 point.) Is
forty
an upword? -
(1 point.) Is
fifty
an upword? -
(6 points.) Complete the implementation of
upword
, below, in such a way that it returnstrue
if and only ifword
is an upword. Returnfalse
ifword
isNULL
, ifword
contains one or more non-alphabetical characters, or if the letters inword
are not alphabetically sorted, case-insensitively.
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
bool upword(const char *word)
{
Debrief
-
Which resources, if any, did you find helpful in answering this problem’s questions?
-
About how long did you spend on this problem’s questions?