EXERCISE 6 Based on the image attached, the program was written for a marketing research firm that wants to determine if a customer prefers Coke or Pepsi over some other drink. In this exercise, use...



EXERCISE 6


Based on the image attached, the program was written for a marketing research firm that wants to determine if a customer prefers Coke or Pepsi over some other drink. In this exercise, use what you have learned about OR logic to study a complete C++ program that uses OR logic in a decision statement.


*Help me solve the following questions. Thank you in advance.


// cokeorPepsi.cpp - This program determines if a customer prefers to<br>// drink Coke or Pepsi or some other drink.<br>#include <iostream><br>#include <string><br>using namespace std;<br>int main ()<br>{<br>string customerFirstName;<br>string customerLastName;<br>string drink = > customerFirstName; cout < "enter="" customer's="" last="" name:="" ";="" cin="">> customerLastName; cout <« "enter="" customer's="" drink="" preference:="" ";="" cin="">> drink; if (drink == "Coke" | drink == "Pepsi") « customerFirstName < endl;=""><« customerlastname="">< endl;="" cout=""><« "customer="" first="" name:="" cout="" «="" "customer="" last="" name:="" cout=""><« "drink:="" "="">< drink="">< endl;="" }="" else="" cout=""><« customerfirstname="">< "="" "="" «="" customerlastname="" does="" not="" prefer="" coke="" or="" pepsi."="">< endl;="">< return="" 0%3b="" "/="">
Extracted text: // cokeorPepsi.cpp - This program determines if a customer prefers to // drink Coke or Pepsi or some other drink. #include #include using namespace std; int main () { string customerFirstName; string customerLastName; string drink = ""; // customer's first name // customer's last name // customer's favorite drink cout <« "enter="" customer's="" first="" name:="" ";="" cin="">> customerFirstName; cout < "enter="" customer's="" last="" name:="" ";="" cin="">> customerLastName; cout <« "enter="" customer's="" drink="" preference:="" ";="" cin="">> drink; if (drink == "Coke" | drink == "Pepsi") « customerFirstName < endl;=""><« customerlastname="">< endl;="" cout=""><« "customer="" first="" name:="" cout="" «="" "customer="" last="" name:="" cout=""><« "drink:="" "="">< drink="">< endl;="" }="" else="" cout=""><« customerfirstname="">< "="" "="" «="" customerlastname="" does="" not="" prefer="" coke="" or="" pepsi."="">< endl;="">< return="">
3. What is the exact output from this program when<br>if (drink ==

Extracted text: 3. What is the exact output from this program when if (drink == "Coke" || drink == "Pepsi") is changed to if(drink == "Coke" && drink == "Pepsi") and the customer's name is Sally Preston and the drink is Coke? 4. What is the exact output from this program when if (drink == "Coke" || drink == "Pepsi") is changed to if (drink == "Coke" || drink == "Pepsi" || drink == "coke" || drink == "pepsi") and the customer's name is Sally Preston, and the drink is pepsi? What does this change allow a user to enter?
Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here