当前位置: 首页>>代码示例>>C++>>正文


C++ List::Budget方法代码示例

本文整理汇总了C++中List::Budget方法的典型用法代码示例。如果您正苦于以下问题:C++ List::Budget方法的具体用法?C++ List::Budget怎么用?C++ List::Budget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在List的用法示例。


在下文中一共展示了List::Budget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
        cout << "3. Things you can do with your budget" << endl;
        cout << "4. Landmarks " << endl;
        cout << "5. Landmarks to visit where you are" << endl;
        cout << "6. Quit" << endl;
        getline(cin,input);
        int choiceI = stoi(input);


        switch(choiceI)
        {
        case 1:
            {
                int g;
                for (int i=0;i<cityList.size()-1;i++)
                {
                    cout<<cityList[i]<<", ";
                    g=i;
                }
                cout<<cityList[g+1]<<endl;
                break;
            }
        case 2:
            {
                tour.displayEdges();
                break;
            }
        case 3:
            {
                string startingCity;
                cout << "Enter where you are:" << endl;
                cin.ignore(1,'\n');
                getline(cin, startingCity);
                string bu;
                cout << "Enter your budget:" << endl;
                getline(cin,bu);
                int b = stoi(bu);
                l.Budget(startingCity,b);
                break;
            }
        case 4:
            {
                string startingCity;
                cout << "Enter where you are:" << endl;
                cin.ignore(1, '\n');
                getline(cin, startingCity);
                bool found = false;
                for (int i=0; i < cityList.size(); i++)
                {
                    if (cityList[i] == startingCity)
                    {
                        found = true;
                    }
                }
                if (found == false)
                {
                    cout << "The city you entered is not in our database." << endl;
                }
                else
                {
                    l.poi(startingCity);
                }
                break;
            }
        case 5:
            {
                string startingCity;
                cout << "Enter where you are:" << endl;
                cin.ignore(1, '\n');
                getline(cin, startingCity);
                bool found = false;
                for (int i=0; i < cityList.size(); i++)
                {
                    if (cityList[i] == startingCity)
                    {
                        found = true;
                    }
                }
                if (found == false)
                {
                    cout << "The city you entered is not in our database." << endl;
                }
                else
                {
                    l.popularLandmarks(startingCity);
                }
            }
        case 6:
            {
                cout << "Goodbye!" << endl;
                false;
                return 0;

            }
        default:
            {
                cout << "Please choose a menu option" << endl;
            }
        }
    }
}
开发者ID:CaptBrunch,项目名称:Muk_CSCI2270_FinalProject,代码行数:101,代码来源:main.cpp


注:本文中的List::Budget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。