C++ Online Compiler
Example: Hello World Program in C++ Using using User-defined Function
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// HELLO WORLD PROGRAM IN C++ USING USER-DEFINED FUNCTION #include <iostream> using namespace std; // Step-1 Create a function to display Hello World void displayMessage() { cout << "HELLO, WORLD!" << endl; } // It's the main function of the program int main() { // Step-2 Display a label cout << "C++ HELLO WORLD PROGRAM" << endl; // Step-3 Call the function to show the message displayMessage(); return 0; }
Output
Clear
ADVERTISEMENTS