An array of String objects, words, has been properly declared and initialized. Each element of words contains a String consisting of lowercase letters (a–z). Write a code segment that uses an enhanced for loop to print all elements of words that end with "ing".
As an example, if words contains {"ten", "fading", "post", "card", "thunder", "hinge", "trailing", "batting"}, then the following output should be produced by the code segment.
fading trailing batting
Write the code segment as described above. The code segment must use an enhanced for loop.

Respuesta :

Answer:

Explanation:

#include <iostream>

using namespace std;

int main()

{

   string cwords[8]={"ten", "fading", "post", "card", "thunder", "hinge", "trailing", "batting"};

   string temp="";

   for (int i=0; i<8; i++)

   {

       temp=cwords[i];

       int j=temp.length();

       if (temp[j-3]=='i' && temp[j-2]=='n' && temp[j-1]=='g')

       {

           cout<<temp<<endl;

       }

   }

   return 0;

}

RELAXING NOICE
Relax