C++ Function Definition Question

Introduction

Write a program that defines a function of type void called printmessage().

The function outputs a "Hello World from a function." message on the standard output.

Call the function from main.

You can use the following code structure.

#include <iostream> 

int main() 
{ 
    //your code here
} 


#include <iostream> 

void printmessage() 
{ 
    std::cout << "Hello World from a function."; 
} 

int main() 
{ 
    printmessage(); 
} 



PreviousNext

Related