We've written this code:
void mainFunction() {
cout << "My name is Andy" << endl;
cout << "I code in Python" << endl;
cout << "I have a dog" << endl;
cout << "My name is Mike" << endl;
cout << "I code in Java" << endl;
cout << "I have a cat" << endl;
cout << "My name is Sarah" << endl;
cout << "I code in JavaScript" << endl;
cout << "I have a parrot" << endl;
}
Write the same code in a better way by creating and calling a function with parameters printMessages()
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
