如何根据输入打开某个菜单? [英] How do based on an input open up a certain menu?

查看:75
本文介绍了如何根据输入打开某个菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以在为项目创建模拟银行账户时我需要在输入后打开三个选项。所以基本上我的代码询问用户他们今天想要什么,有四个选项存入支票,两个提取现金支票账户余额和四个选项,如果你键入不同的那三个。所以我需要知道的是,如果用户说提取现金我希望他们被引导到我的代码部分,这与检查帐户余额或存入支票相比。



我尝试了什么:



我只是不确定该怎么做。

SO in creating a mock bank account for a project and I need to have three options open up after an input. So basically my code asks the user what they would like to d today and there are four options one deposit a check, two withdraw cash the checking account balance and four options if you type something different then those three. SO what I need to know is if the user says withdraw cash I want them to be directed to the part of my code that does that vs checking account balance or depositing check.

What I have tried:

I'm just not sure how to do it.

推荐答案

您需要读取输入值,然后使用一组if / else语句来决定用户想要什么。首先为每个操作编写一个函数,即存款,取款等。然后根据用户的输入调用相关函数。
You need to read the input value, and then use a set of if/else statements to decide what the user wants. Start by writing a function for each operation, i.e. deposit, withdraw etc. Then call the relevant function based on the user's input.


这篇关于如何根据输入打开某个菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆