| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 665 人关注过本帖
标题:看不懂这个程序,可否帮忙写一下注释,详细一点呀
取消只看楼主 加入收藏
bta_zgh
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-12-20
收藏
 问题点数:0 回复次数:0 
看不懂这个程序,可否帮忙写一下注释,详细一点呀

using System;

using System.Collections;

using System.Text ;

public class telephonebox

{

private ArrayList telebook;

public telephonebox()

{

telebook = new ArrayList();

}

public void storeScords(String item)

{

telebook.Add(item);

Console.WriteLine("插入成功!");

}

public void deleteItem(int index)

{

if(index <= 0 || index > telebook.Count )

{

Console.WriteLine("无此记录");

}

else

telebook.RemoveAt(index-1);

}

public void listRecords()

{

int n=0;

Console.WriteLine("********************************************************************");

while(n<telebook.Count)

{

Console.WriteLine("{0}.{1}",n+1,telebook[n]);

n++;

}

Console.WriteLine("********************************************************************");

}

public void displayItem(int index)

{

if(index <= 0 || index > telebook.Count )

{

Console.WriteLine("Sorry,no find such Record!");

}

else

{

Console.WriteLine("*******************************************************************************");

Console.WriteLine ("您要查看的记录如下:");

Console.WriteLine(telebook[index-1]);

Console.WriteLine("*******************************************************************************");

}

}

public void getactulAmount()

{

Console.WriteLine("Now the telebook have {0} records",telebook.Count);

}

public static void Main()

{

telephonebox telebook = new telephonebox();

telebook.storeScords("VX,3333333");

telebook.storeScords("FI ,565645645");

Console.WriteLine("********************************************************************");

Console.WriteLine("Welcome to my TELEPHONE BOOK.\n");

telebook.getactulAmount();

telebook.listRecords();

Console.WriteLine("Please acording to bleows and CHOOSE an DATA to edit this TELEPHONE BOOK you want,enter 0 to exit ");

Console.WriteLine("1.LIST all records.");

Console.WriteLine("2.DISPLAY a specific record.");

Console.WriteLine("3.APPEND a new record.");

Console.WriteLine("4.DELETE a specific record.");

Console.WriteLine("5.Show the total AMOUNT of records.");

Console.WriteLine("0.Exit.");

Console.WriteLine("*******************************************************************************");

String choice,new_record;

int num;

do

{

Console.WriteLine("");

Console.Write("please input an DATA option to edit this TELEPHONE BOOK: ");

choice = Console.ReadLine();

switch (choice)

{

case "1":

telebook.listRecords();

break;

case "2":

Console.Write("Which record do you want to Find:");

num = int.Parse(Console.ReadLine());

telebook.displayItem(num);

break;

case"3":

Console.Write("Please input a record, using 逗号 to separate name and phone code :");

new_record= Console.ReadLine();

telebook.storeScords(new_record);

break;

case"4":

Console.Write("Which record do you want to DELETE ,please input a number:");

num = int.Parse(Console.ReadLine());

telebook.deleteItem(num);

Console.WriteLine ("Deleted successful!");

break;

case"5":

telebook.getactulAmount();

break;

case"0":

Console.WriteLine("telebook has exited");

break;

default:

Console.WriteLine("\nDo you want to find telephone number?\n");

break;

}

}while(choice!="0");

}

}

搜索更多相关主题的帖子: left align 注释 using 
2005-12-25 23:11
快速回复:看不懂这个程序,可否帮忙写一下注释,详细一点呀
数据加载中...
 
   



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

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