switch
これが機能しない理由がわかりません。このステートメントを使用するのはこれが初めてです。
int main() {
string typed;
ofstream theFile("players.txt");
ifstream theFile2("players.txt");
cout << "Do you want to read or write" << endl;
cin >>typed;
switch(typed){
case "write":
cout << "Enter players Id, Name and Money" << endl;
cout << "Press Ctrl+Z to exit\n" << endl;
while(cin >> idNumber >> name >> money){
theFile << idNumber << ' ' << name << ' ' << money << endl;
}break;
case "read":
while (theFile2 >> id >> nametwo >> moneytwo){
cout << id << ", " << nametwo << ", " << moneytwo << endl;
}break;
}
}