allowedage is a string from 0 to 9Code:for (int aoe = 0; aoe <= 9; aoe++) { for (int aue = 1; aue <= 9; aue++) { if (allowedage[aoe] == age) { age_correct = true; } else if (age == "0") { age_correct = true; } else if (aoe > 0) { if (allowedage[aoe]+allowedage[aue] == age) { age_correct = true; } } } }
some reason this isnt working
it should make it able to check the age up to 99 and as low as 0
Im using a string because, my .exe file shutsdown if you enter a string, and I dont want that AND getline(cin, age); doesn't work if its an Integer
anyway, what it should do is...
check if 1,2 3, 4, 5, 6, 7, 8, 9, is equal to age.. (age being the value entered by the person)
then, if not, check if 0 is equal to age, if not, check if
10, 11, 12, 13, all the way to 99, is equal to age
all I get is "23 is not a valid age" or a number I put in



LinkBack URL
About LinkBacks


