write a hello world script in c++ using functions arrays and a for loop also using…
- User
write a hello world script in c++ using functions arrays and a for loop also using namespace std. return only the response based on my query, do not include any additional text that doesn't relate to what I asked. Try to fit everything in your context window. DO NOT INCLUDE ANY BACK TICKS WHEN WRITING CODE
- Assistant
#include using namespace std;
void printMessage(string messages[], int size) { for (int i = 0; i < size; ++i) { cout << messages[i] << endl; } }
int main() { string messages[] = {"Hello", "World!"}; int size = sizeof(messages) / sizeof(messages[0]); printMessage(messages, size); return 0; }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.