Using Boolean Variables and Branching Logic

Having trouble running this code keep getting this error when putting g++

/usr/bin/ld:tryIt4B: file format not recognized; treating as linker script
/usr/bin/ld:tryIt4B:1: syntax error
collect2: error: ld returned 1 exit status


// Lab 4 tryIt4B -- Using Boolean Variables and Branching Logic
// Determine what each output statement will print.
#include <iostream>
using namespace std;

int main()
{
bool hungry = true,
sleepy = false,
happy = true,
lazy = false;

cout << hungry << " " << sleepy << endl;

if (hungry == true)
cout << "I'm hungry. \n";

if (sleepy == true)
cout << "I'm sleepy. \n";

if (hungry)
cout << "I'm still hungry. \n";
else
cout << "I'm not hungry. \n";

if (sleepy)
cout << "I'm still sleepy. \n";
else
cout << "I'm not sleepy. \n";

if (sleepy)
cout << "I'm sleepy. \n";
else if (lazy)
cout << "I'm lazy. \n";
else if (happy)
cout << "I'm happy. \n";
else if (hungry)
cout << "I'm hungry. \n";

return 0;
}

Thank you guys for the help.
Name your file tryIt4B.cpp.
Topic archived. No new replies allowed.