🔒 Closed Çℎḙḡḡ Account

Status
Not open for further replies.
https://www.Çℎḙḡḡ.com/homework-help...-1a-write-following-statements-disp-q12735049

paunlock nga rin po. salamat po
 

Expert Answer
information icon


  • Anonymous's Avatar

    Anonymousanswered this
    Was this answer helpful?
    Thumbs up inactive

    1
    Thumbs down inactive

    0
    8,620 answers
    1a. Write what the following statements display as output after the program executes.
    int temperature = 78;
    int month = 6;
    string name = "Pat Boone";
    if ( temperature >= 70 && month >=6) //temperature greater than or equal to 70 condition satisfies. month >= 6 also satisfies.
    cout << "Wear white shoes.\n"; //So, this statement will be executed.
    else if (name == "Pat Boone")
    cout << "Wear white shoes.\n";
    else
    cout << "Wear black shoes.\n";
    So, the output of the above code is: Wear white shoes.
    1b. What is the output of the program in Exercise 1a when temperature = 70, month = 5, and name = “Pat Boone”?
    int temperature = 70;
    int month = 5;
    string name = "Pat Boone";
    if ( temperature >= 70 && month >=6) //temperature greater than or equal to 70 condition satisfies. month >= 6 condition fails.
    cout << "Wear white shoes.\n";
    else if (name == "Pat Boone") //name == Pat Boone condition satisfies.
    cout << "Wear white shoes.\n"; //So, this statement will be executed.
    else
    cout << "Wear black shoes.\n";
    So, the output of the above code is: Wear white shoes.
    1c. What is the output of the program in Exercise 1a when temperature = 60, month = 5, and name = “Pat Boone”?
    int temperature = 60;
    int month = 5;
    string name = "Pat Boone";
    if ( temperature >= 70 && month >=6) //temperature greater than or equal to 70 condition fails.
    cout << "Wear white shoes.\n";
    else if (name == "Pat Boone") //name == Pat Boone condition satisfies.
    cout << "Wear white shoes.\n"; //So, this statement will be executed.
    else
    cout << "Wear black shoes.\n";
    So, the output of the above code is: Wear white shoes.
    1d. What is the output of the program in Exercise 1a when temperature = 60, month = 5, and name = “Your name”?
    int temperature = 60;
    int month = 5;
    string name = "Hershley";
    if ( temperature >= 70 && month >=6) //temperature greater than or equal to 70 condition fails.
    cout << "Wear white shoes.\n";
    else if (name == "Pat Boone") //name == Pat Boone condition also fails.
    cout << "Wear white shoes.\n";
    else
    cout << "Wear black shoes.\n"; //So obviously, this statement will be executed.
    So, the output of the above code is: Wear black shoes.
    Comment
 
Status
Not open for further replies.

About this Thread

  • 83
    Replies
  • 2K
    Views
  • 14
    Participants
Last reply from:
Soobin_ms

Trending Topics

Online now

Members online
540
Guests online
1,549
Total visitors
2,089

Forum statistics

Threads
2,274,157
Posts
28,953,924
Members
1,235,103
Latest member
North005
Back
Top