-
bool flag;
if (flag == true) {
cout << "true";
} else {
cout << "false";
}
- Be careful, if you mess this up you will have a problem:
-
bool flag;
if (flag = true) {
cout << "true";
} else {
cout << "false";
}
- Will always print "true", why?
-
bool flag;
if (true = flag) {
cout << "true";
} else {
cout << "false";
}
- Will this compile?
- Would be better, and I would like to do this, but I can't seem to adjust to it.
-
bool flag;
if (flag) {
cout << "true";
} else {
cout << "false";
}
- Is actually what I prefer.