本文整理汇总了C++中Database::DisplayAll方法的典型用法代码示例。如果您正苦于以下问题:C++ Database::DisplayAll方法的具体用法?C++ Database::DisplayAll怎么用?C++ Database::DisplayAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::DisplayAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(){
int in_yob, ranking;
string in_first_name, in_last_name, in_genre, in_fact, last_name, in_composer;
char selection, choice;
Database myDB;
do {
DisplayMenu();
cin >> selection;
cout << endl;
while (!cin || selection < 48 || selection > 53){
cin.clear();
cout << "Please make a valid selection" << endl;
DisplayMenu();
cin >> selection;
}
switch (selection) {
case 49 : {
cout << "First Name: ";
cin >> in_first_name;
cout << "Last Name: ";
cin >> in_last_name;
cout << "Genre: ";
cin >> in_genre;
cout << "Year of Birth: ";
cin >> in_yob;
while (!cin || in_yob < 1){
cin.clear();
cin.ignore(1000, '\n');
cout << "Enter a positive integer for year of birth: ";
cin >> in_yob;
}
cout << "Fact: ";
cin >> in_fact;
last_name = in_last_name;
transform(last_name.begin(), last_name.end(), last_name.begin(), ::tolower);
Composer& last_name = myDB.AddComposer(in_first_name, in_last_name,
in_genre, in_yob, in_fact);
cin.clear();
} break;
case 50 : {
cout << "Enter composers last name: ";
cin >> in_last_name;
cout << endl;
myDB.GetComposer(in_last_name);
} break;
case 51 : {
do{
cout << "Which composer would you like to promote/demote? " << endl;
cin >> in_composer;
cout << "Set ranking: ";
cin >> ranking;
while(ranking > 10 || ranking < 1){
cin.clear();
cout << "Please enter a ranking between 1 and 10" << endl;
cout << "Set ranking: ";
cin >> ranking;
}
cout << endl;
myDB.SetRanking(in_composer, ranking);
myDB.GetComposer(in_composer);
cout << "Would you like to change another ranking? (y/n)";
cin >> choice;
}while (::tolower(choice) == 121);
cin.clear();
} break;
case 52 : {
myDB.DisplayAll();
} break;
case 53 : {
myDB.DisplayByRank();
} break;
case 48 :
break;
default :
cout << "Please make a valid selection" << endl;
}
} while (selection != 48);
}