Discover a wealth of knowledge at Westonci.ca, where experts provide answers to your most pressing questions. Join our platform to connect with experts ready to provide precise answers to your questions in various areas. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our platform.
Sagot :
Answer:
Following are the code to this question:
#include <iostream>//header file
#include <string>//header file
using namespace std;
int main() //main method
{
string item;//defining a string variable
int n;//defining integer variable
while(cin >>n >>item)//defining while loop to input value
{
if(item == "quito" && n == 0)//use if block to check input value
{
break;//use break keyword
}
cout << "Eating " << n << " " << item << " a day keeps the doctor away." << endl;//print input value with the message
}
return 0;
}
Output:
Please find the attached file.
Explanation:
In this code, inside the main method one string variable and one integer variable "item, n" is defined, that uses the while loop for input the value and uses the if block that checks string value is equal to "quito" and n value is equal to "0" it breaks the loop, and print the value with the message.
We hope you found this helpful. Feel free to come back anytime for more accurate answers and updated information. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. We're glad you chose Westonci.ca. Revisit us for updated answers from our knowledgeable team.