Skip to main content

Posts

Showing posts with the label example of function prototyping

Function Prototyping in c++ with example and code

// Prototypes void DisplayMenu(); int GetSelection(); // The main() function. int main() { // Display the menu. DisplayMenu(); // Get the menu selection. int selection; selection = GetSelection(); // Select the matching process. if (selection == 1) std::cout << "Processing Receivables" << std::endl; else if (selection == 2) std::cout << "Processing Payables" << std::endl; else if (selection == 3) std::cout << "Quitting" << std::endl; else std::cout << "\aInvalid selection" << std::endl; return 0; } void DisplayMenu() { std::cout << "--- Menu ---" << std::endl; std::cout << "1=Receivables" << std::endl; std::cout << "2=Payables" << std::endl; std::cout << "3=Quit" << std::endl; } int GetSelection() { int selection; std::cou