diff options
author | RossTheRoss <msattr@gmail.com> | 2019-02-24 11:56:45 -0600 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-02-24 11:56:45 -0600 |
commit | 1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47 (patch) | |
tree | c8a1dfd010bb2c052b8e554a66a51a313b821f5b /ee1301/wk3 | |
parent | Get rid of Particle stuff (diff) | |
download | homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.tar homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.tar.gz homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.tar.bz2 homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.tar.lz homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.tar.xz homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.tar.zst homework-1890f33d93f6643c4491b0c6f10ff3ae7ac7bc47.zip |
Finish 3C
Diffstat (limited to 'ee1301/wk3')
-rw-r--r-- | ee1301/wk3/hw3_directory/strap012_HW3C.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/ee1301/wk3/hw3_directory/strap012_HW3C.cpp b/ee1301/wk3/hw3_directory/strap012_HW3C.cpp index 59b1347..ac7bc1c 100644 --- a/ee1301/wk3/hw3_directory/strap012_HW3C.cpp +++ b/ee1301/wk3/hw3_directory/strap012_HW3C.cpp @@ -4,10 +4,36 @@ #include <iomanip> using namespace std; char 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') + { + New = s + 32; + cout << ", I respond with " << New; + } + else + { + cout << ", which is not a valid character"; + } + } + cout << "." << endl; } int main() { - + char character; + do { + cout << "Please enter a character that is an ASCII letter in the range [A-Za-z]: "; + cin >> character; + if (character!='@') { + swapCase(character); + } + } while (character!='@'); }
\ No newline at end of file |