标题:如何在C#中实现查看功能
只看楼主
qq1004974443
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:9
专家分:3
注 册:2010-10-13
结帖率:0
 问题点数:0 回复次数:1 
如何在C#中实现查看功能
using System;
using System.Text;
using
class A
{
    public static void Main()
    {
        B();
        Console.Write("请按[ENTER]键继续...");
        Console.ReadLine();
    }
    public static void B()
    {
        for (; ; )
        {
            Console.WriteLine("欢迎使用本程序");
            Console.WriteLine("程序功能如下");
            Console.WriteLine();
            Console.WriteLine("【1】添加约会");
            Console.WriteLine("【2】浏览约会");
            Console.WriteLine("【3】搜索【输入日期以浏览所有那天的约会】");
            Console.WriteLine("【0】退出程序");
            Console.WriteLine();
            Console.Write("选择功能:");
            int G = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine();
            switch (G)
            {
                case 1:
                    MA();
                    break;
                case 2:
                    AK();
                    break;
                case 3:
                    Console.WriteLine("很抱歉,暂不支持该功能!");
                    break;
                case 0:
                    return;
                default:
                    Console.WriteLine("功能选择错误,请重新输入!");
                    break;
            }
            Console.Write("\n请按[ENTER]键继续...");
            Console.ReadLine();
            Console.Clear();
        }
    }
    private static void AK()
    {
        FileStream fs = new FileStream(@"F:\\约会管理程序.txt", FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read);
        StreamReader sr = new StreamReader(fs, Encoding.Default);
        sr.BaseStream.Seek(0, SeekOrigin.Begin);
        string MM;
        MM = sr.ReadToEnd();
        Console.WriteLine(MM);
        fs.Close();
        sr.Close();
    }
    public static void MA()
    {
        FileStream fs = new FileStream(@"F:\\约会管理程序.txt", FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write);
        StreamWriter sw = new StreamWriter(fs, Encoding.Default);
        sw.BaseStream.Seek(0, SeekOrigin.End);
        sw.WriteLine();
        Console.Write("注意:日期格式为(mm-dd-yyyy)!!!\n约会的日期:");
        sw.Write("约会的日期:");
        DateTime J;
        sw.WriteLine((J = Convert.ToDateTime(Console.ReadLine())).ToString("MM-dd-yyyy"));
        Console.Write("约会的时间:");
        sw.Write("约会的时间:");
        sw.WriteLine(Console.ReadLine());
        Console.Write("姓名:");
        sw.Write("姓名:");
        sw.WriteLine(Console.ReadLine());
        sw.Close();
        fs.Close();
    }   
}
新手求教,
  以上,如何实现功能3
  另找个C#的QQ交流群
  知道的回下谢谢!

搜索更多相关主题的帖子: void 约会 public 如何 
2010-11-15 22:06
qq1004974443
Rank: 1
来 自:重庆
等 级:新手上路
帖 子:9
专家分:3
注 册:2010-10-13
得分:0 
z咋没人理我呢?
2010-11-16 11:35



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




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

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