#How to make a simple true or false program in c++

2 messages · Page 1 of 1 (latest)

hot portal
#

alright, so i just started today, and I wanted to see if i could make a simple "is this correct?" type thing. but how would I make it so the input can be a Boolean?

my thought process is that that the x is the user input. but I'm not sure. also why does it output a zero at the end? I know i've done something wrong.

using namespace std;

int main() {
  bool x;
  cout << "do dogs eat meat? \n";
  cin >> x;
  cout << "correct! \n" << x;
  return 0;
}

the code.

#

usually, the return 0 is not visible.