2012-09-29 54 views
0

我有这个代码的麻烦,我想为我的课写。程序本身工作,直到循环。我从来没有做过一个循环,而且在她介绍它的那一天我还没有上课,所以我就猜测它是如何完成的。如果任何人都可以发表评论,我应该如何解决这个问题会很好。这也是在VBA我需要帮助,试图解决这个循环

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 
+0

请添加更多细节。你能指望什么?你遇到什么问题? – Macmade

回答

2

1)设定N = “N”
2)循环直到LCASE(runReply)= N

+0

它仍然继续循环,即使有变化 – Cristian

+0

Nevermind。我没有注意到你的报价 – Cristian

+0

好吧,我很高兴你帮助解决了循环。 – Mate