在我的程序上需要一些帮助.... [英] Need some help with my program....
本文介绍了在我的程序上需要一些帮助....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好.我需要一些时间来帮助我...
我被告知要做的事情:
Hello guys. I need some of your time to help me...
What I''ve been told to do :
1. Create a menu that contains the following options: Get a persons details (p) Get the Salary (s) Calculate and display (d) Exit (x)<br />
2. Display the menu and wait for the users response.<br />
3. Process the options entered until the user enters ''x'' to quit.<br />
Using a switch statement organise the code to suit the options.
我需要一些有关循环和重复的帮助,因为希望我做出适当的努力来允许用户重新输入已被检测为无效的数据
我只能用于循环,而循环则可以用于循环和嵌套循环.
到目前为止我所做的...
I need some help on looping and repetition because I''m expected to put appropriate effort into allowing the user to re-enter data that has been detected as invalid
I only can use for Loop, while Loop do while Loop and nested loops.
What I''ve done so far...
nothing.
推荐答案
.NET零本书 [ ^ ],其中说明了如何使用特征.他还对解释类和对象的使用做了很长的解释.
There is some very useful information in .NET Book Zero[^] by Charles Petzold, which explains how to use such features. He also goes a long way to explain the use of classes and objects.
您的循环具有各种退出条件和各种循环条件.最好的选择是创建一个无限的while循环,并在适当时使用break语句退出它.例如:
Your loop has various exit conditions, and various looping conditions. Best bet will be to create an infinite while loop and exit it with break statements as appropriate. for eg:
while(true)
{
while(input is invalid)
{
//ask for and validate input
}
//Do work with the validated input here
if(user wants to exit)
{
break;
}
}
这篇关于在我的程序上需要一些帮助....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文