So here’s my code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
bool hungry;
char isHungry;
cout << "Are you hungry? y/n" << endl;
cin >> isHungry;
if (isHungry == 'y')
{
cout << "Eating..." << endl;
}
else {
cout << "Welp..." << endl;
}
return 0;
}
So why is
if (isHungry == 'y')
not
if (isHungry == "y")
When should you use speech marks and when quotation?
Thanks!