#include #include #include using namespace std; class WordT { public: string word; int integer; float real; }; int main() { WordT word{"hello", 3, 3.14f}; WordT list1[]{{"hello", 3, 3.14f},{"goodby",2,1}}; vector list2{{"hello", 3, 3.14f},{"goodby",2,1}}; WordT list3[][2]{ { {"hello", 3, 3.14f}, {"goodby",2,1} }, {{"greeting", 1, 1},{"farewell",2,2}}, {{"hi", 3, 3},{"bye",4,4}} }; string a{"Hello"}; int b{3}; float c{3.14139f}; WordT word2{a,b,c}; // will not compile //WordT bad1{'a',3l, 2.0L}; //size_t d = 3; //WordT bad2{"a word",d, 2.1f}; //WordT bad3{"A word",3, 2.1}; cout << "The instance " << endl; cout << word.word << " " << word.integer << " " << word.real << endl; cout << endl << endl; cout << "The array" << endl; for (auto x: list1) { cout << x.word << " " << x.integer << " " << x.real << endl; } cout << endl << endl; cout << "The vector" << endl; for (auto x: list2) { cout << x.word << " " << x.integer << " " << x.real << endl; } cout << endl << endl; cout << "The 2D array " << endl; for (auto x : list3) { for(int i {0}; i < 2; i++) { cout << x[i].word << " " << x[i].integer << " " << x[i].real << endl; } } return 0; }