Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

My professor wants us to jot down the output but I am having trouble running thi

ID: 3801375 • Letter: M

Question

My professor wants us to jot down the output but I am having trouble running this. I've tried adding or rearranging things but no success, I am new to this still.

1 Lab 4 It 4B 8 int main 10 bool hungry true 11 sleepy false 12 happy true 13 lazy false 14 cout hungry sleepy endl; 17 if (hungry FF true) cout I'm hungry. In 18 19 20 if (sleepy true) cout I'm sleepy. In 21 22 23 if (hungry) cout I'm still hungry. In 24 25 else cout I'm not hungry. Mn'' 26 27 28 if (sleepy) cout I'm still sleepy. In 29 30 else cout I'm not sleepy. Mn'' 31 32 33 if (sleepy) cout I'm sleepy. Vn'' 34 35 else if (lazy) cout m lazy. In 36 37 else if (happy) cout m happy. Vn'' 38 39 else if (hungry) cout I'm hungry. In 41 42 return 0 43 Expected Output served output

Explanation / Answer

Here is the code explained:

//Lab 4 tryIt4B
#include <iostream>
using namespace std;
int main()
{  
    bool hungry = true,
        sleepy = false,
        happy = true,
        lazy = false;
          
    cout << hungry << " " << sleepy << endl;   //Ex:   true, false       Obs: 1 0
   
    if(hungry == true)
        cout << "I'm hungry. ";   //Ex:   I'm hungry.           Obs: I'm hungry.
   
    if(sleepy == true)
        cout << "I'm sleepy. ";   //Ex:                       Obs:
   
    if(hungry)  
        cout << "I'm still hungry. ";   //Ex: I'm still hungry.   Obs: I'm still hungry.
    else
        cout << "I'm not hungry. ";   //Ex:  
   
    if(sleepy)
        cout << "I'm still sleepy. ";   //Ex:
    else
        cout << "I'm not sleepy. ";   //Ex:   I'm not sleepy.   Obs: I'm not sleepy.
   
    if(sleepy)
        cout << "I'm sleepy. ";       //Ex:
    else if(lazy)
        cout << "I'm lazy. ";           //Ex:
    else if(happy)
        cout << "I'm happy. ";           //Ex: I'm happy.   Obs: I'm happy.
    else if(hungry)
        cout << "I'm hungry. ";       //Ex:
   
    return 0;                                      
}

Ex: Expected Output.

Obs: Observed Output.

And if I wrote nothing, means, no output expected.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote