car_dealer.cpp

来自「这是一个简单的 用于标准汽车店的统计管理程序 有多个子程序构成」· C++ 代码 · 共 57 行

CPP
57
字号
/*
Name: CHAI, Wennan
StudentID: 780621
Program: car_dealer.cpp
Description:
*/

#include <iostream>
#include <string>
#include "TCarMarket.h"
using namespace std;


int InputChoice()
{
    int choice;
   
        do
        {
            cout<<"Please select one from the value (1-4) : ";
            cin>>choice;
        }while( (choice<1) || (choice>4));
    
    return choice;
}

void ShowMenu()
{
    cout<<"=========================="<<endl;
    cout<<"          MENU            "<<endl;
    cout<<"1  --  Add a car          "<<endl;
    cout<<"2  --  Sell a car         "<<endl;
    cout<<"3  --  List all cars      "<<endl;
    cout<<"4  --  Exit               "<<endl;
    cout<<"                          "<<endl;
    cout<<"=========================="<<endl;
}

int main()
{
    int  c;
    TCarMarket Newshop;
    do
    {
        ShowMenu();
        c = InputChoice();
        if(c==1){Newshop.AddCar();}
        if(c==2){Newshop.ListCar(); Newshop.SellCar();}
        if(c==3){Newshop.ListCar();}
    }while (c!=4);


    return 0;
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?