class Program
{
static void Main(string[] args)
{
q: System.Console.WriteLine("请选择职称:");
System.Console.WriteLine("1.教授");
System.Console.WriteLine("2.讲师");
System.Console.WriteLine("3.辅导员");
System.Console.WriteLine("4.显示工资条");
System.Console.WriteLine("5.显示员工信息");
System.Console.WriteLine("6.退出");
int i = System.Int32.Parse(Console.ReadLine()); Teachers[] teach = new Teachers[1000]; switch(i)
{
case 1:
System.Console.WriteLine("你选择的是教授");
string proname = System.Console.ReadLine();
int prohours = System.Int32.Parse(Console.ReadLine());
Professor pro = new Professor(proname, prohours);
pro.display();
for (int count = 0; count < 1000; count++)
{
teach[count] = new Professor(proname, prohours);
} goto q;//goto //...
case4:
System.Console.WriteLine("请输入员工姓名:");
string name = System.Console.ReadLine();
for (int x = 0; x < e; x++)
{
if (teach[x].Name == name)
{
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", teach[x].Name, teach[x].Title, teach[x].Salary, teach[x].Classfee, teach[x].Hours, teach[x].Wage, teach[x].Tax); }
default: System.Console.WriteLine("你输入有误!请重新输入!");goto q;
} 请问我在case1最后加上goto q以后,在运行到case4,能输出在case1中输入的内容么,如果不能应该用什么?我的目的是在选1的时候输入信息(在case1后面加goto是为了可以重返主菜单输入多条信息),选4的时候能显示前面输入的其它内容
{
static void Main(string[] args)
{
q: System.Console.WriteLine("请选择职称:");
System.Console.WriteLine("1.教授");
System.Console.WriteLine("2.讲师");
System.Console.WriteLine("3.辅导员");
System.Console.WriteLine("4.显示工资条");
System.Console.WriteLine("5.显示员工信息");
System.Console.WriteLine("6.退出");
int i = System.Int32.Parse(Console.ReadLine()); Teachers[] teach = new Teachers[1000]; switch(i)
{
case 1:
System.Console.WriteLine("你选择的是教授");
string proname = System.Console.ReadLine();
int prohours = System.Int32.Parse(Console.ReadLine());
Professor pro = new Professor(proname, prohours);
pro.display();
for (int count = 0; count < 1000; count++)
{
teach[count] = new Professor(proname, prohours);
} goto q;//goto //...
case4:
System.Console.WriteLine("请输入员工姓名:");
string name = System.Console.ReadLine();
for (int x = 0; x < e; x++)
{
if (teach[x].Name == name)
{
Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", teach[x].Name, teach[x].Title, teach[x].Salary, teach[x].Classfee, teach[x].Hours, teach[x].Wage, teach[x].Tax); }
default: System.Console.WriteLine("你输入有误!请重新输入!");goto q;
} 请问我在case1最后加上goto q以后,在运行到case4,能输出在case1中输入的内容么,如果不能应该用什么?我的目的是在选1的时候输入信息(在case1后面加goto是为了可以重返主菜单输入多条信息),选4的时候能显示前面输入的其它内容
解决方案 »
- listview虚拟模式相关问题
- 一个简单的C#学生成绩管理系统
- 关于数据库与表格显示的问题!
- 极有难度,透明flash作为窗体背景,或者说只播放透明的flash播放
- vs2008各大版本的区别
- 远程处理!!!!! 急!!!!!! 在线。。。。。。
- winform高手 帮帮忙吧
- C#照片图像打印问题
- DataSet医生请进
- DataGrid的数据绑定的问题,如果数据库的字段为空,datagrid.selecteditem.cells[2].text.tostring() 的值为" " ,microsoft 的目的
- 用.NET制作安装包后,怎么样改变setup.exe的图标
- webrequest返回部分网页源代码
代码就没看了.吃饭了.过来UP下.
少用GOTO。。你自己也会被搞晕的```
( 猜)
\ (
\_)