help explain

i have a infill code,but the problem is that i don't understand why put ! in this code(!in.is_open()) i understand that
is_open to check whether the file has successfully been opened, if so prints out the content of the file, otherwise -like for example if the file to be opened doesn't exist- an error message is shown.
The ! is a logical "not".

You already know that:
1
2
3
4
if ( in.is_open() )
{
    // do something
}
if (the file "in" is open)
{
    do something
}


So the logical not, turns our statement into:
1
2
3
4
if ( !in.is_open() )
{
    // do something
}
if (the file "in" is not open )
{
    do something
}
Topic archived. No new replies allowed.