diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-27 12:25:43 -0600 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-27 12:25:43 -0600 |
commit | 850b130375fb626167c00aba6aeba16f751910c8 (patch) | |
tree | 9efbd6be8c2e95d733f4eafdd9701ab597b30064 | |
parent | Final fixes (diff) | |
download | homework-850b130375fb626167c00aba6aeba16f751910c8.tar homework-850b130375fb626167c00aba6aeba16f751910c8.tar.gz homework-850b130375fb626167c00aba6aeba16f751910c8.tar.bz2 homework-850b130375fb626167c00aba6aeba16f751910c8.tar.lz homework-850b130375fb626167c00aba6aeba16f751910c8.tar.xz homework-850b130375fb626167c00aba6aeba16f751910c8.tar.zst homework-850b130375fb626167c00aba6aeba16f751910c8.zip |
Some final touches/editing
Diffstat (limited to '')
-rw-r--r-- | ee1301/wk3/hw3_directory/strap012_HW3B.cpp | 2 | ||||
-rw-r--r-- | ee1301/wk3/hw3_directory/strap012_HW3C.cpp | 17 |
2 files changed, 9 insertions, 10 deletions
diff --git a/ee1301/wk3/hw3_directory/strap012_HW3B.cpp b/ee1301/wk3/hw3_directory/strap012_HW3B.cpp index dac276d..4a80ae7 100644 --- a/ee1301/wk3/hw3_directory/strap012_HW3B.cpp +++ b/ee1301/wk3/hw3_directory/strap012_HW3B.cpp @@ -58,7 +58,7 @@ int charTest (char character) { if (character>= 'A' && character<='Z') { return 3; } else { - return 0; + return 0; } } } diff --git a/ee1301/wk3/hw3_directory/strap012_HW3C.cpp b/ee1301/wk3/hw3_directory/strap012_HW3C.cpp index 61af587..54f9af5 100644 --- a/ee1301/wk3/hw3_directory/strap012_HW3C.cpp +++ b/ee1301/wk3/hw3_directory/strap012_HW3C.cpp @@ -16,8 +16,7 @@ using namespace std; void swapCase(char s); -int main() -{ +int main() { char character; do { //This loops until '@' is entered cout << "Please enter a character that is an ASCII letter in the range [A-Za-z]: "; @@ -37,16 +36,16 @@ int main() void swapCase(char s) { char New; cout << "You entered " << s; - if (s >= 'a' && s <= 'z') { - New= s - 32; - cout << ", I respond with " << New; - } else { + if ( (s >= 'a' && s <= 'z') || (s >= 'A' && s <= 'Z') ) { + cout << ", I respond with "; if (s >= 'A' && s <= 'Z') { - New = s + 32; - cout << ", I respond with " << New; + New = s + 32; //32 is the difference between capital and lowercase ASCII characters } else { + New= s - 32; + } + cout << New; + } else { cout << ", which is not a valid character."; } - } cout << endl; }
\ No newline at end of file |