| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 651 人关注过本帖
标题:请各位帮忙看一下,这个程序有什么不足(输入exit不能退出,输入溢出后显示 ...
只看楼主 加入收藏
lavzchen
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-10-20
收藏
 问题点数:0 回复次数:0 
请各位帮忙看一下,这个程序有什么不足(输入exit不能退出,输入溢出后显示有问题),给我改进方法,谢谢
主体程序
Module Module1

    Sub Main()
        Dim a As String
        Dim st As New StudentClass

        While True
            Console.Write("输º?入¨?要°a查¨¦询¡¥的Ì?学¡ì号?(ꡧ1-5)ê?:êo")
            a = Console.ReadLine()
            If (a.Equals("exit")) Then
            End If
            Dim ID As String
            ID = a

            Select Case ID
                Case "1"
                    st.stuID = "001"
                    st.stuName = "小?王ª?"
                    st.stuSex = "男D"
                    st.stuAge = "19"
                    st.stuClass = "通ª¡§信?"
                    st.stuJg = "南?京?"
                Case "2"
                    st.stuID = "002"
                    st.stuName = "小?陈?"
                    st.stuSex = "男D"
                    st.stuAge = "21"
                    st.stuClass = "计?算?机¨²"
                    st.stuJg = "上¦?海¡ê"
                Case "3"
                    st.stuID = "003"
                    st.stuName = "小?李¤?"
                    st.stuSex = "女?"
                    st.stuAge = "17"
                    st.stuClass = "软¨¨ª件t"
                    st.stuJg = "杭?州Y"
                Case "4"
                    st.stuID = "004"
                    st.stuName = "小?张?"
                    st.stuSex = "女?"
                    st.stuAge = "20"
                    st.stuClass = "通ª¡§信?1"
                    st.stuJg = "天¬¨¬津¨°"

                Case "5"
                    st.stuID = "005"
                    st.stuName = "小?赵?"
                    st.stuSex = "男D"
                    st.stuAge = "18"
                    st.stuClass = "软¨¨ª件t"
                    st.stuJg = "河¨®北À¡À"
                Case Else
                    Console.WriteLine("超?出?查¨¦询¡¥范¤?围¡ì")

            End Select

            st.printStuInfo(st)   '打䨰印®?查¨¦询¡¥结¨¢果?

        End While
    End Sub

End Module
类文件
Public Class StudentClass
    Private _stuID As String        '学¡ì号?
    Private _stuName As String      '名?字Á?
    Private _stuSex As String       '性?别Àe
    Private _stuAge As String       '年¨º龄¢?
    Private _stuClass As String     '班㨤级?
    Private _stuJg As String        '籍?贯¨¢
    Public Sub printStuInfo(ByVal st As StudentClass)
        Console.WriteLine("学¡ì号?:êo" & st.stuID)
        Console.WriteLine("姓?名?:êo" & st.stuName)
        Console.WriteLine("性?别Àe:êo" & st.stuSex)
        Console.WriteLine("年¨º龄¢?:êo" & st.stuAge)
        Console.WriteLine("班㨤级?:êo" & st.stuClass)
        Console.WriteLine("籍?贯¨¢:êo" & st.stuJg)
    End Sub
    '属º?性?:êo学¡ì号?
    Public Property stuID() As String
        Get
            Return _stuID
        End Get
        Set(ByVal value As String)
            _stuID = value
        End Set
    End Property

    '姓?名?
    Public Property stuName() As String
        Get
            Return _stuName
        End Get
        Set(ByVal value As String)
            _stuName = value
        End Set
    End Property

    '性?别Àe
    Public Property stuSex() As String
        Get
            Return _stuSex
        End Get
        Set(ByVal value As String)
            _stuSex = value
        End Set
    End Property
    '年¨º龄¢?
    Public Property stuAge() As Integer
        Get
            Return _stuAge
        End Get
        Set(ByVal value As Integer)
            _stuAge = value
        End Set
    End Property
    '班㨤级?
    Public Property stuClass() As String
        Get
            Return _stuClass
        End Get
        Set(ByVal value As String)
            _stuClass = value
        End Set
    End Property
    '籍?贯¨¢
    Public Property stuJg() As String
        Get
            Return _stuJg
        End Get
        Set(ByVal value As String)
            _stuJg = value
        End Set
    End Property

End Class
搜索更多相关主题的帖子: exit 改进 输入 
2010-10-20 23:49
快速回复:请各位帮忙看一下,这个程序有什么不足(输入exit不能退出,输入溢出后 ...
数据加载中...
 
   



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

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