diff options
Diffstat (limited to 'ee1301/wk3/hw3_directory/strap012_HW3B.cpp')
-rw-r--r-- | ee1301/wk3/hw3_directory/strap012_HW3B.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/ee1301/wk3/hw3_directory/strap012_HW3B.cpp b/ee1301/wk3/hw3_directory/strap012_HW3B.cpp index 128f5fa..dac276d 100644 --- a/ee1301/wk3/hw3_directory/strap012_HW3B.cpp +++ b/ee1301/wk3/hw3_directory/strap012_HW3B.cpp @@ -14,28 +14,7 @@ Character Detection #include <iomanip> using namespace std; -// Function: charTest -// --------------------------- -// Tests to see what kind of character was inputted -// character: Self-explanatory -// returns: 1 if number, 2 if lower case, 3 if upper case, 0 if not any of the previous - -int charTest (char character) { - if (character >= '0' && character <= '9') - { - return 1; - } else { - if (character>='a' && character<='z') { - return 2; - } else { - if (character>= 'A' && character<='Z') { - return 3; - } else { - return 0; - } - } - } -} +int charTest (char character); int main () { int test; @@ -62,3 +41,25 @@ int main () { cout << endl; } } + +// Function: charTest +// --------------------------- +// Tests to see what kind of character was inputted +// input: character from prompt in main +// returns: 1 if number, 2 if lower case, 3 if upper case, 0 if not any of the previous + +int charTest (char character) { + if (character >= '0' && character <= '9') { + return 1; + } else { + if (character>='a' && character<='z') { + return 2; + } else { + if (character>= 'A' && character<='Z') { + return 3; + } else { + return 0; + } + } + } +}
\ No newline at end of file |