首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我需要帮助来解决这个循环

我需要帮助来解决这个循环
EN

Stack Overflow用户
提问于 2012-09-30 02:28:23
回答 1查看 107关注 0票数 0

我在为我的类编写这段代码时遇到了问题。程序本身会一直工作到循环结束。我以前从来没有做过循环,而且她介绍它的那天我也不在课堂上,所以我只是在猜测它是如何完成的。如果有人能就我该如何修复它发表评论,那就太好了。这也是在VBA中

代码语言:javascript
复制
Module Bits

    Dim employeeName As String
    Dim currentSalary As Decimal
    Dim payIncrease As Single
    Dim runReply As Char
    Dim employeeSalary As Single
    Dim numbersOfEmployees As Decimal
    Dim projectedSalary As Decimal
    Dim increasedSalary As Decimal
    Dim y As Char
    Dim n As Char

    Sub Main()

            Console.Out.WriteLine("Bits and Pieces Manufacturing Company")
            Console.Out.WriteLine(DateString & "                        By.Cristian Bouchez")

        Do

            Console.Out.Write(vbCrLf & "Enter your employee's name:                    ")
            employeeName = Console.In.ReadLine()
            Console.Out.Write("Enter your employee's current weekly salary:  $")
            currentSalary = Console.In.ReadLine()
            Console.Out.Write("Enter your employee's pay increase:           %")
            payIncrease = Console.In.ReadLine()

            payIncrease = payIncrease / 100
            employeeSalary = currentSalary * payIncrease
            payIncrease = payIncrease * 100
            employeeSalary = employeeSalary + currentSalary

            numbersOfEmployees = numbersOfEmployees + 1
            projectedSalary = projectedSalary + currentSalary
            increasedSalary = increasedSalary + (employeeSalary - currentSalary)

            Console.Out.WriteLine(vbCrLf & vbCrLf & employeeName & " will earn $" & employeeSalary & _
                                  " after a %" & payIncrease & " raise.")

            Console.Out.WriteLine(vbCrLf & "Do you want to calaculate another employee's weekly pay?")
            Console.Out.Write("Enter Y for yes and N for no:  ")
            runReply = Console.In.ReadLine()

            Console.ReadKey()

        Loop Until runReply = n

        Console.Out.WriteLine(vbCrLf & "*******************************" & vbCrLf)

    End Sub

End Module
EN

回答 1

Stack Overflow用户

发布于 2012-09-30 02:41:57

1)设置n= "n“

2)循环直到LCase(runReply) =n

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12655335

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档