Simple Example Program for Function In C++
On this page (7sections)
About this program
This is an example program in c function example programs. Read the concept first: C++ Function Basics, then study the code and output below.
Definition
A function is a group of code or code block, which performs a specific task
We have some terminology to refer to functions:
- A function’s inputs are known as its arguments
- A function that gives some kind of answer back to the main function.
For Better Understanding,
Syntax
return_type function_name(argumnent)
{
// body Of the Function
}
Simple Example Program for Function
/* Example Program For Simple Example Program Of Function In C++
little drops @ thiyagaraaj.com
Coded By: THIYAGARAAJ MP */
#include<iostream>
#include<conio.h>
using namespace std;
// Simple Function printmessage()
void printmessage() {
cout << "Im Function In C++";
}
int main() {
//Call Simple Function printmessage()
printmessage();
getch();
return 0;
}
Sample Output
Im Function In C++
Related Pages
Learn the concept first, then study the code:
- C++ Programs — Browse all C++ Programs.
- C++ Function Basics — Tutorial — declaring and calling functions in C++.
- Simple Example Program for Function Find Smallest Number In C++ — More in c function example programs.
- Simple Example Program for Function to Find Factorial In C++ — More in c function example programs.