Write a loop that reads strings from console input where the string is either "duck" or "goose". The loop terminates when "goose" is read in. After the loop, your code should print out the number of "duck" strings that were read.

PHOTO EMBED

Fri Sep 22 2023 21:55:55 GMT+0000 (Coordinated Universal Time)

Saved by @David_Mix

string word;
int n = 0;
cin >> word;
while (word == "duck") 
{
  n++;
  cin >> word;
}
cout << n << endl;
content_copyCOPY