aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ee1301/wk3/hw3_directory/strap012_HW3C.cpp30
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