Here's what I"m trying to do. I want to have the user input a letter, y OR n. I then want to put a 'tolower' statement in there so if the user puts in a Y or N it will automatically be made a lowercase letter. Then, it will be tested with an "if, else" ladder. Kind of like:
The idea, as I said, is if the user enters a capital letter instead of a lowercase one, it'll still work. Any way to do it using the tolower () function? If not, there's always:
I have. I understand that it has to go in some sort of loop, either for() or while(). I'm just having problems making it work. I either get an error when I have an asterix next to the variable name, or it'll put an extra space in there. Then when I go to test it in the if (), it keeps going to error. It may be that I'm trying to do it on only 1 character instead of a string. I really don't know though. I lack the experience in programming to make the absolute judgement call. I worked with this for about 3 hours last night trying to make it do what I wanted it to do, but no luck. The other thing I was looking at trying to do was test if an entry was a number or a character. All of this is with data integrity in mind, preventing Garbage in Garbage out.
Thank you so much for that example. The ones that I had all seen usually involved some kind of loop as I mentioned in my previous post. I think the problem was I was overthinking it, and didn't quite understand the examples. In fact, I think that's a better example than most that I've seen.
Well, if you're converting a string, you do need a loop. tolower() only takes a single character and returns a single character.
But your yesNo isn't a string. It's a character.