Feb 8, 2017 at 6:45pm UTC
At line 12, instead of testing for size, test the contents of answer for "yes" or "no".
Feb 8, 2017 at 6:47pm UTC
you should test
if(answer == "yes")
but, most folks would convert the input to upper or lower case and then test against the appropriate value so it triggers off yes, Yes, YES, yEs, etc
Last edited on Feb 8, 2017 at 6:48pm UTC
Feb 8, 2017 at 6:52pm UTC
so
if (answer == y) would work?
Feb 8, 2017 at 7:12pm UTC
is there a way to cover every version of yes and no or do you have to write everyone out
Feb 8, 2017 at 7:19pm UTC
Last edited on Feb 8, 2017 at 7:22pm UTC
Feb 8, 2017 at 7:22pm UTC
it would be == "y" but that would work. y is a variable. 'y' is a character. "y" is a string. You have a variable in your question.
you can lump together with converting to lowercase and then using some simple ors..
if(answer == "y" || answer == "yes" || others...)