Void Functions
//void function example
//void_function.cpp
#include <iostream>
using namespace std;
void say_hello(); //function prototypes (declarations)
void say_goodbye();
int main()
{
int choice;
cout << "Do you want me to say Hello(1) or Goodbye(2)?";
cin >> choice;
while (choice !=1 && choice!=2)
{
cout << "Choose again";
cin >> choice;
}
if (choice == 1)
{
say_hello(); //function call
}
else
{
say_goodbye();
}
return 0;
} //end of main
//function definitions
void say_hello()
{
cout << "\n\t\t********HELLO**********\n";
}
void say_goodbye()
{
cout << "\n\t\t\t\t\t@@@@@@@@@@@@@@@@@@@@Good-Bye@@@@@@@@@@@@@@@@@\n";
}