pr04005.cpp
来自「c++编程宝典源码及Quincy99编译器 是《标准C++编程宝典》电子工业出」· C++ 代码 · 共 58 行
CPP
58 行
////////////////////////////////////////
// File Name: pr04005.cpp
////////////////////////////////////////
#include <iostream>
// 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;
}
////////////////////////////////////////
// Display a menu.
////////////////////////////////////////
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;
}
////////////////////////////////////////
// Read a menu selection from the
// keyboard.
////////////////////////////////////////
int GetSelection()
{
int selection;
std::cout << "Enter Selection: ";
std::cin >> selection;
return selection;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?