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:


#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
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: