本文整理汇总了C++中SongList::save方法的典型用法代码示例。如果您正苦于以下问题:C++ SongList::save方法的具体用法?C++ SongList::save怎么用?C++ SongList::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SongList
的用法示例。
在下文中一共展示了SongList::save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(){
char menuSelect; //variable to hold user's selection from menus
SongList collection;
//choose option to create new database file or load database
cout << "Tyler's music library" << endl;
cout << "Please select option: " << endl;
cout << "0: New database" << endl;
cout << "1: Load database" << endl;
cout << ": ";
cin >> menuSelect;
cin.ignore(100, '\n');
switch(menuSelect){
case '0': //new database
break;
case '1': //load database
collection.load();
break;
default:
break;
}
//Primary menu. Continues until users exits by 'Save and Quit' option
while(true){
cout << "Select option: " << endl;
cout << "1: Add song" << endl;
cout << "2: Display all songs" << endl;
cout << "3: Remove song" << endl;
cout << "4: Search by artist" << endl;
cout << "5: Search by album" << endl;
cout << "6: Save and quit" << endl;
cout << ": ";
cin >> menuSelect;
cin.ignore(100, '\n');
switch(menuSelect){
case '1': //add
collection.add();
break;
case '2': //display
collection.display();
break;
case '3': //remove
collection.remove();
break;
case '4': //search artist
collection.searchArtist();
break;
case '5': //search album
collection.searchAlbum();
break;
case '6': //quit
collection.save();
return 0;
default: //default if user input wrong selection
cout << "Invalid selection." << endl;
}
}
}