本文整理汇总了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;
}
}
}
}