void inputAnswers(char given[]) { const int numQuestions = 10; for (int index = 0; index > given[index]; } } double numRight(char given[]) { double numRight = 0; char correctAnswers[10] = {'B','C', 'A', 'D', 'B', 'A', 'D', 'C', 'A', 'B'}; for (int index = 0; index < numQuestions; index++) { if (given[index] == correctAnswers[index]) { numRight++; } } Question: How can I get this program to accept lower and uppercase inputs? Any suggestions? Thanks
djblade · Nov 6, 2014 9:01 PM · 301 views
islower - Check if character is lowercase letter isupper - Check if character is uppercase letter toupper - Convert lowercase letter to uppercase tolower - Convert uppercase letter to lowercase
lanthus · Nov 7, 2014 8:30 AM
While comparing, change both to lower, so you don't need to worry about what the inputs case is, I dont know the exact syntax in c++ but something like this. if (given[index].toLower() == correctAnswers[index].toLower())
prankster · Nov 7, 2014 10:29 AM
Thanks for your suggestions
djblade · Nov 7, 2014 10:45 AM
This conversation is preserved exactly as it was on the original Sajha.com and can't accept new replies.
Start a New Discussion