never mind i got it. thanks

Member Avatar for Mouche

This is where you input -1 in the second time:

cin >> dayOfWeek;

if (cin.good())
break;

cin.good() evaluates to true and the while loop exits.

Wouldn't it be better to do something like this?

(psuedo code)

tries = 3
while tries > 0
    ask for day
    if day is not >1 and <8
        tries--
    else
        // print/return success
        break
    if tries is 0
        // print/return failure
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.