The required function is written in C++:
#include <iostream>
using namespace std;
void func_input(int);
int main()
{
int in_num;
cout<<"Please enter 1,2, or 3 : ";
cin>>in_num;
func_input(in_num);
return 0;
}
void func_input(int in_n)
{
if (in_n==1 || in_n==2 || in_n==3)
{
if (in_n==1)
cout<<"door 1 opened";
if (in_n==2)
cout<<"door 2 opened";
if (in_n==3)
cout<<"door 3 opened";
}
else
cout<<"Please enter a valid number";
}
Please find the implementation of the function with output in the given attachment.
You can learn more about function at
https://brainly.com/question/16362961
#SPJ4