#include <iostream>
#include <string>
int main() {
// Step 1: Declare variables
int size;
// Step 2: Get the size of the array from the user
std::cout << "Enter the size of the array: ";
std::cin >> size;
// Step 3: Declare a pointer to an array of strings
std::string *stringArray = new std::string[size];
// Step 4: Get strings from the user and store them in the array
for (int i = 0; i < size; ++i) {
std::cout << "Enter string " << i + 1 << ": ";
std::cin >> stringArray[i];
}
// Step 5: Display the strings in the array
std::cout << "Strings in the array:" << std::endl;
for (int i = 0; i < size; ++i) {
std::cout << "String " << i + 1 << ": " << stringArray[i] << std::endl;
}
// Step 6: Deallocate the dynamically allocated memory
delete[] stringArray;
return 0;
}