diff options
Diffstat (limited to 'ee1301/wk3/hw3_directory/strap012_HW3B.cpp')
-rw-r--r-- | ee1301/wk3/hw3_directory/strap012_HW3B.cpp | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/ee1301/wk3/hw3_directory/strap012_HW3B.cpp b/ee1301/wk3/hw3_directory/strap012_HW3B.cpp index 1b3faed..128f5fa 100644 --- a/ee1301/wk3/hw3_directory/strap012_HW3B.cpp +++ b/ee1301/wk3/hw3_directory/strap012_HW3B.cpp @@ -14,6 +14,29 @@ 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 main () { int test; char character; @@ -39,27 +62,3 @@ int main () { cout << endl; } } - - -// 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; - } - } - } -}
\ No newline at end of file |