We've wrritten this code:
void mainFunction() {
cout << "Hello AlgoCademy!" << endl;
cout << "Coding is amazing!" << endl;
cout << "Functions are so useful!" << endl;
cout << "Hello AlgoCademy!" << endl;
cout << "Coding is amazing!" << endl;
cout << "Functions are so useful!" << endl;
cout << "Hello AlgoCademy!" << endl;
cout << "Coding is amazing!" << endl;
cout << "Functions are so useful!" << endl;
}
Write the same code in a better way by creating and calling a function printMessages()
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
