Write a C++ program which define function with no argument and no return value.
In this program we are taking display() as user defined function with no return type and have no argument passed in it.
Program Code:
In this program we are taking display() as user defined function with no return type and have no argument passed in it.
Program Code:
#include <iostream>
using namespace std;
// user defined function with no argument and have no return type
void display()
{
int x;
cout<<"Enter a Number to display : ";
cin>>x;
cout<<endl;
cout<<"You Entered value of a : ";
cout<<x;
}
// main() function with user defined function call
int main()
{
int a;
// user defined function call in the main() function
display();
return 0;
}
The program output is tested on www.jdoodle.com
Output:
Enter a Number to display : 2
You Entered value of a : 2
Thanks
Mukesh Rajput
Post A Comment:
0 comments: