Menu: 、 Tables: 、 Waiter: などの見出しで整理された構成設定の txt ファイルを読み取る必要があります。
正しいセクションが見つかったら、正しい情報を引き出す必要があります。したがって、基本的にはテキスト ファイルで特定の文字列を検索しようとしています。その文字列が見つかったら、その文字列を含む行の後にある行から入力の保存を開始します。
私がこれまでに試したこと。
void MenuItemArray()
{
string arrayIn;
ifstream fin("/usr/local/final_project/restaurant/config.txt");
while (getline(fin, arrayIn))
{
if (arrayIn.find("Menu:") == true)
{
}
私が引っ張っているテキストファイル:
Tables: table #, max seats
1 2
2 4
3 2
4 2
5 2
6 4
7 6
8 10
9 2
10 4
11 4
12 4
13 4
14 2
15 2
16 2
17 2
18 2
Waiters: first name followed by table list
John 1,2,5,9,11,15
Maria 3,4,6,7,17,18
Mike 8,10,12,13,14,16
Menu: listing of the full menu: item code, name, price
A1 Bruschetta 5.29
A2 Caprese_Flatbread 6.10
A3 Artichoke-Spinach_Dip 3.99
A4 Lasagna_Fritta 4.99
A5 Mozzarella_Fonduta 5.99
E1 Lasagna_Classico 6.99
E2 Capellini_Pomodoro 7.99
E3 Eggplant_Parmigiana 8.99
E4 Fettuccine_Alfredo 7.49
E5 Tour_of_Italy 14.99
D1 Tiramisu 2.99
D2 Zeppoli 2.49
D3 Dolcini 3.49
S1 Soda 1.99
S2 Bella_Limonata 0.99
S3 Berry_Acqua_Fresca 2.88