标题:可以近来看一下!
取消只看楼主
chali
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-1-11
 问题点数:0 回复次数:1 
可以近来看一下!
Do 循环: Do loop.cs





using System;
class Doloop {
public static void Main() {
string myChoice;
do {
// Print A Menu
Console.WriteLine("My Address Book\n");
Console.WriteLine("A - Add New Address");
Console.WriteLine("D - Delete Address");
Console.WriteLine("M - Modify Address");
Console.WriteLine("V - View Addresses");
Console.WriteLine("Q - Quit\n");
Console.WriteLine("Choice (A,D,M,V,or Q): ");

// Retrieve the user's choice
myChoice = Console.ReadLine();
// Make a decision based on the user's choice
switch(myChoice) {
case "A":
case "a":
Console.WriteLine("You wish to add an address.");
break;
case "D":
case "d":
Console.WriteLine("You wish to delete an address.");
break;
case "M":
case "m":
Console.WriteLine("You wish to modify an address.");
break;
case "V":
case "v":
Console.WriteLine("You wish to view the address list.");
break;
case "Q":
case "q":
Console.WriteLine("Bye.");
break;
default:
Console.WriteLine("{0} is not a valid choice", myChoice);
}

// Pause to allow the user to see the results
Console.Write("Press any key to continue...");
Console.ReadLine();
Console.WriteLine();
} while (myChoice != "Q" && myChoice != "q"); // Keep going until the user wants to quit
}
}






为什么编译不能通过呢?
搜索更多相关主题的帖子: public Choice 
2005-03-20 21:34
chali
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2005-1-11
得分:0 
对了,里面的 default   到底是什么意思呀!!!!!!!!!!!!!

2005-03-20 21:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-13692-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.592459 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved