CStringArray myArray; myArray.Add("John"); myArray.Add("Mary"); myArray.Add("Jessica"); for(int i = 0; i < myArray.GetSize(); i++) { std::cout << myArray.GetAt(i) << std::endl; }
CStringArray myArray; CString str("Hello World"); myArray.Add(str.MakeUpper()); for(int i = 0; i < myArray.GetSize(); i++) { std::cout << myArray.GetAt(i) << std::endl; }This example creates a CStringArray called myArray and a CString object called str initialized with the string "Hello World". It then uses the MakeUpper() method to convert the string to all uppercase letters, adds it to the array, and prints it to the console. Both examples use the CStringArray class from the MFC library in C++.