Discuss C++ Programming in the C Programming forum on Dev Shed. C++ Programming C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Time spent in forums: 9 m 52 sec
Reputation Power: 0
// Ex11.cpp, Multiple alternatives
// This is getting a bit labourious! We will see an easier way to do this later
char day; // gives us a bit more practice with 'char' variables
cout << "enter the first letter of the day\n";
cin >> day;
if (day == 'm' || day == 'M' )cout << "Monday";
else if (day == 't') cout << "Tuesday";
else if (day == 'w' || day == 'W') cout << "Wednesday";
else if (day == 'T') cout << "Thursday";
else if (day == 'f' || day == 'F') cout << "Friday";
else if (day == 's') cout << "Saturday";
else if (day == 'S') cout << "Sunday";
} // end of main
// trying to get days tues, thurs, saturday, sunday to output in Lower and upper case. Don't know how to do this.
Last edited by SimonGreenhill : October 8th, 2006 at 09:53 PM.
Reason: adding code tags
Time spent in forums: 1 Month 2 Weeks 4 Days 15 h 34 m 57 sec
Reputation Power: 1735
Since someone is going to point this out eventually, might as well be me:
1. Why is this not posted in the C++ programming forum?
2. Your thread title is horrible. You could post this in the C++ programming forum, and then put the essence of your question in the title.
3. Your code should be posted in CODE tags. This preserves indentation in the code. And makes it look nice.
Now then, onto the real point of your question. Actually, your question is a bit vague. What is the end result you want? You want "Tuesday" and so on to output in lowercase. Why don't you just manually output them as wanted?
Two more things to note. First, as per C++ standard, main returns an int. So it is int main, not void main. Second, it's #include <iostream>. Not iostream.h. As per the 99 revision, the standard library has been moved in the std namespace. Hence, you most likely will want to add using namespace std to your code.