ターミナルでC++プログラム用に次の構造を作成しようとしています。
Menu:
[1] Add Number
[2] View Numbers
[3] View Average
[CHOICE 1]
- Add a Number to array
- Once finished, show Menu again so user can select another action
[CHOICE 2]
- View all numbers in array
- Once finished, show Menu again so user can select another action
[CHOICE 3]
- View average of all numbers in array
- Once finished, show Menu again so user can select another action
これをどのように設定するか正確にはわかりません。ユーザーが各メニュー項目のそれぞれの番号を入力すると、対応する情報が表示されます。これは、ifステートメントを使用してユーザーが入力した番号を探すので、非常に簡単です。
ただし、ユーザーが別のアクションを選択できるようにメニューを再度表示しようとすると、問題が発生します。ここで何らかのループが必要であることは認識していますが、どうすればよいかわかりません。
これを開始する方法の基本構造を設定するのを手伝ってもらえますか?本当にありがたいです。