Given a bool variable isReadable write some statements that assign true to isReadable if the file "topsecret" exists and can be read by the program and assigns false to isReadable otherwise.
.
.
Click on the title for the solution
.
.
ifstream filename;
filename.open("topsecret");
if (filename.fail()){
isReadable=false;
}else{
isReadable=true;
}
.
Click on the title for the solution
.
.
This is the answer:
:
ifstream filename;
filename.open("topsecret");
if (filename.fail()){
isReadable=false;
}else{
isReadable=true;
}
Comments
Post a Comment