none
If you are good at finding Errors help me here RRS feed

  • Question

  • Hi,

    I am making a calculator, I am new to Small Basic so I just wanted help to see if anyone can find a bug/glitch or error.

    This is the code it is 723 Lines

    Goto Start
    iend1:
    TextWindow.Clear()
    TextWindow.WriteLine("Input Not Recognized")
    TextWindow.WriteLine("Try Again")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("To try again type (Reset)")
    TextWindow.WriteLine("To end program type (End)")
    TextWindow.WriteLine(" ")
    iend1 = TextWindow.Read()
    If iend1 = "Reset" Or iend1 = "reset" Then 
      Goto Start
    ElseIf iend1 = "End" or iend1 = "end" then 
      Program.End()
    Else 
      Goto iend1
    EndIf
    Start:
    TextWindow.Clear()
    TextWindow.WriteLine("Addition Type (+)")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("Multiplication Type (x)")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("Subtraction Type (-)")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("Division Type (/)")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("Type (Reset) at any time to Reset Program")
    TextWindow.WriteLine("Type (End) at any time to End Program")
    TextWindow.WriteLine(" ")
    type = TextWindow.Read()
    If type = "x" Or type = "X" Then 
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("How many numbers are you going to multiply?")
      TextWindow.WriteLine("2 - 6")
      TextWindow.WriteLine(" ")
      mtype1 = TextWindow.ReadNumber()
    ElseIf type = "+" then 
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("How many numbers are you going to add?")
      TextWindow.WriteLine("2 - 6")
      TextWindow.WriteLine(" ")
      atype1 = TextWindow.ReadNumber()
    ElseIf type = "-" Then 
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("How many numbers are you going to subtract?")
      TextWindow.WriteLine("2 - 6")
      TextWindow.WriteLine(" ")
      stype1 = TextWindow.ReadNumber()
    ElseIf type = "/" Then
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("How many numbers are you going to divide?")
      TextWindow.WriteLine("2 - 6")
      TextWindow.WriteLine(" ")
      dtype1 = TextWindow.ReadNumber()
    ElseIf type = "End" or type = "end" Then
      Program.End()
    Else 
      Goto iend1
    EndIf
    
    
    
    
    
    
    If mtype1 = "2" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a*b)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end1 = TextWindow.Read()
      If end1 = "Reset" Or end1 = "reset" Then
        Goto Start
      ElseIf end1 = "End" or end1 = "end" then
        Program.End()
      Else 
        Goto iend1
      EndIf
    ElseIf mtype1 = "3" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a*b*c)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf mtype1 = "4" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a*b*c*d)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf mtype1 = "5" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a*b*c*d*e)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf mtype1 = "6" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#6 Please Enter a Number")
      f = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a*b*c*d*e*f)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
      
      
      
      
      
      
      
    ElseIf atype1 = "2" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a+b)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end1 = TextWindow.Read()
      If end1 = "Reset" Or end1 = "reset" Then
        Goto Start
      ElseIf end1 = "End" or end1 = "end" then
        Program.End()
      Else 
        Goto iend1
      EndIf
    ElseIf atype1 = "3" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a+b+c)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf atype1 = "4" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a+b+c+d)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf atype1 = "5" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a+b+c+d+e)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf atype1 = "6" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#6 Please Enter a Number")
      f = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a+b+c+d+e+f)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
      
      
      
      
    elseIf stype1 = "2" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a-b)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end1 = TextWindow.Read()
      If end1 = "Reset" Or end1 = "reset" Then
        Goto Start
      ElseIf end1 = "End" or end1 = "end" then
        Program.End()
      Else 
        Goto iend1
      EndIf
    ElseIf stype1 = "3" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a-b-c)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf stype1 = "4" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a-b-c-d)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf stype1 = "5" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a-b-c-d-e)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      Endif
    ElseIf stype1 = "6" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#6 Please Enter a Number")
      f = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a-b-c-d-e-f)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
      
      
      
      
      
    elseIf dtype1 = "2" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end1 = TextWindow.Read()
      If end1 = "Reset" Or end1 = "reset" Then
        Goto Start
      ElseIf end1 = "End" or end1 = "end" then
        Program.End()
      EndIf
    ElseIf dtype1 = "3" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf dtype1 = "4" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c/d)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf dtype1 = "5" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c/d/e)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      Endif
    ElseIf dtype1 = "6" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#6 Please Enter a Number")
      f = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c/d/e/f)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    Else 
      Goto iend1
    EndIf  


    I love coding. This is signature is 100% Original. :)

    Saturday, February 11, 2017 9:55 AM

Answers

  • Hi ! don't forget that division by zero is impossible so:

    i would suggest to insert in whturner33 code at line 26 to 34

    _____________________________________________________________________________

    For dig=1 to mtype1
          TextWindow.Write("Give number "+dig+" ")
          digit[dig]=Textwindow.ReadNumber()
         
            If type=4 and digit[dig]= 0 then
              TextWindow.WriteLine(" division by zero impossible retry ")
            run=0
            EndIf
        endfor

    _______________________________________________________________________________

    • Marked as answer by Forbidden Duck Saturday, February 11, 2017 6:26 PM
    Saturday, February 11, 2017 1:47 PM
    Answerer
  • Hi Forbidden Duck

    Here is my solution for a small textwindow simple calculator:

    What do yo think of ?

    (division by zero not allowed with a 3 clic sound warning !)

    The next step to this program would be to insert SUB to allow more then 2 numbers per operation.

    The full program hold in around 100 lines ( with colors and sound ) all in text.window

    After each operation, the program.delay wait for 3 seconds and then restart.

    Have fun !

    see: program : GKG293

    • Marked as answer by Forbidden Duck Saturday, February 11, 2017 6:52 PM
    Saturday, February 11, 2017 6:35 PM
    Answerer

All replies

  • Simple test worked for me, but 723 lines is a lot to check!

    Challenge for SB community

    As a challenge can you or anyone rewrite this kind of TextWindow calculator in shorter code.

    As part of the challenge, try not to use GoTo.

    Saturday, February 11, 2017 10:56 AM
    Moderator
  • Insert these 4 lines at Start: to reset the calculation mode:

    ...Start: mtype1=0 atype1=0 stype1=0 dtype1=0 TextWindow.Clear()....


    Saturday, February 11, 2017 10:59 AM
  • Here is my first try at this challenge. As I have little time at the moment, the Reset and End part is not implemented yet. There may be some bugs but the program is only 48  lines:
    ' calculator WhTurner 171011
    str="1=add;2=multyply;3=subtract;4=divide"
    run=1
    While run=1
      TextWindow.Clear()
      TextWindow.WriteLine("    CALCULATOR")
      TextWindow.WriteLine("    ==========")
      TextWindow.WriteLine("Addition Type (+)")
      TextWindow.WriteLine("Multiplication Type (*)")
      TextWindow.WriteLine("Subtraction Type (-)")
      TextWindow.WriteLine("Division Type (/)")
      TextWindow.WriteLine("Type (Reset) at any time to Reset Program")
      TextWindow.WriteLine("Type (End) at any time to End Program")
      TextWindow.WriteLine(" ")
      type = Text.ConvertToLowerCase(Text.GetSubText(TextWindow.Read(),1,1))
      type = Text.GetIndexOf("+*-/re",type)
      If type=5 Then
        run=0
      ElseIf type<5 then
        TextWindow.WriteLine("How many numbers are you going to "+str[type]+"?")
        TextWindow.WriteLine("2 - 6")
        TextWindow.WriteLine(" ")
        mtype1 = TextWindow.ReadNumber()
        mtype1 = 1+Text.GetIndexOf("23456",mtype1)
        For dig=1 to mtype1
          TextWindow.Write("Give number "+dig+" ")
          digit[dig]=Textwindow.ReadNumber()
        endfor
      else
        run=0
      EndIf
      If run=1 Then
        ans=digit[1]
        For dig=2 To mtype1
          If type=1 then
            ans = ans+digit[dig]
          ElseIf type=2 then
            ans=ans*digit[dig]
          ElseIf type=3 then
            ans=ans-digit[dig]
          ElseIf type=4 then
            ans=ans/digit[dig]
          EndIf
        EndFor
        TextWindow.WriteLine("Answer = "+ans)
        TextWindow.Pause()
      EndIf
    EndWhile
        


    Jan [ WhTurner ] The Netherlands


    Saturday, February 11, 2017 12:52 PM
    Answerer
  • Hi ! don't forget that division by zero is impossible so:

    i would suggest to insert in whturner33 code at line 26 to 34

    _____________________________________________________________________________

    For dig=1 to mtype1
          TextWindow.Write("Give number "+dig+" ")
          digit[dig]=Textwindow.ReadNumber()
         
            If type=4 and digit[dig]= 0 then
              TextWindow.WriteLine(" division by zero impossible retry ")
            run=0
            EndIf
        endfor

    _______________________________________________________________________________

    • Marked as answer by Forbidden Duck Saturday, February 11, 2017 6:26 PM
    Saturday, February 11, 2017 1:47 PM
    Answerer
  • for example , your code is shortened as below

    type="/"
    type1=3
    inputdata()

    Sub inputdata
      sum="x=1;+=0;-=0;/=1"

     a=""

      For i=1 To type1
        TextWindow.WriteLine(" ")
        TextWindow.WriteLine("#"+i+"  Please Enter a Number:")
        a[i] = TextWindow.ReadNumber()
        If type="x" Then
          sum["x"]=sum["x"]*a[i]
        ElseIf type="/" then
          If i=1 then
          sum["/"]=a[i]/sum["/"]
          else
          sum["/"]=sum["/"]/a[i]
          EndIf
        elseif type="+" then
          sum["+"]=sum["+"]+a[i]
        elseif type="-" then
          sum["-"]=sum["-"]-a[i]
        EndIf
      EndFor
      If  type="-" Then
        sum["-"]=sum["-"]+2*a[1]
      EndIf
      TextWindow.WriteLine(" ")
      TextWindow.Write("Answer Is: ")
      TextWindow.WriteLine(sum[type])
    EndSub


    Saturday, February 11, 2017 2:17 PM
    Answerer
  • I know I made it hard for myself but hey still worked didn't it :P

    I love coding. This is signature is 100% Original. :)

    Saturday, February 11, 2017 5:50 PM
  • Good point. Program does crash over trying to Divide by 0 :P

    I love coding. This is signature is 100% Original. :)

    Saturday, February 11, 2017 5:57 PM
  • Here I added it in for you. Just a simple version for how the original was written out

    Add this under (Goto Start | iend1:)

    Goto Start
    dtype0:
    TextWindow.Clear()
    TextWindow.WriteLine("Input Error")
    TextWindow.WriteLine("Dividing by 0 is impossible")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("To try again type (Reset)")
    TextWindow.WriteLine("To end program type (End)")
    TextWindow.WriteLine(" ")
    dtype0i = TextWindow.Read()
    If dtype0i = "Reset" Or dtype0i = "reset" Then
      Goto Start
    ElseIf dtype0i = "End" or dtype0i = "end" Then
      Program.End()
      EndIf

    And just copy this over the original (if dtype = ETC)

    elseIf dtype1 = "2" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      If a = "0" or b = "0" Then
        Goto dtype0
        EndIf
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end1 = TextWindow.Read()
      If end1 = "Reset" Or end1 = "reset" Then
        Goto Start
      ElseIf end1 = "End" or end1 = "end" then
        Program.End()
      EndIf
    ElseIf dtype1 = "3" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
        If a = "0" or b = "0" or c = "0" Then 
        Goto dtype0
        EndIf
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf dtype1 = "4" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
        If a = "0" or b = "0" or c = "0" or d = "0" Then
        Goto dtype0
        EndIf
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c/d)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    ElseIf dtype1 = "5" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      If a = "0" or b = "0" or c = "0" or d = "0" or e = "0" Then
        Goto dtype0
        EndIf
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c/d/e)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      Endif
    ElseIf dtype1 = "6" Then  
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#1 Please Enter a Number:")
      a = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#2 Please Enter a Number")
      b = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#3 Please Enter a Number")
      c = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#4 Please Enter a Number")
      d = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#5 Please Enter a Number")
      e = TextWindow.ReadNumber()
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("#6 Please Enter a Number")
      f = TextWindow.ReadNumber()
      
      If a = "0" or b = "0" or c = "0" or d = "0" or e = "0" or f = "0" Then
        Goto dtype0
        EndIf
      
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Answer Is: ")
      TextWindow.WriteLine(a/b/c/d/e/f)
      TextWindow.WriteLine(" ")
      TextWindow.WriteLine("Type (Reset) to reset program")
      TextWindow.WriteLine("Type (End) to end program")
      TextWindow.WriteLine(" ")
      end2 = TextWindow.Read()
      If end2 = "Reset" Or end2 = "reset" Then
        Goto Start
      ElseIf end2 = "End" or end2 = "end" then
        Program.End()
      Else 
        Goto iend1  
      EndIf
    Else 
      Goto iend1
    EndIf


    I love coding. This is signature is 100% Original. :)

    Saturday, February 11, 2017 6:11 PM
  • Hi Forbidden Duck

    Here is my solution for a small textwindow simple calculator:

    What do yo think of ?

    (division by zero not allowed with a 3 clic sound warning !)

    The next step to this program would be to insert SUB to allow more then 2 numbers per operation.

    The full program hold in around 100 lines ( with colors and sound ) all in text.window

    After each operation, the program.delay wait for 3 seconds and then restart.

    Have fun !

    see: program : GKG293

    • Marked as answer by Forbidden Duck Saturday, February 11, 2017 6:52 PM
    Saturday, February 11, 2017 6:35 PM
    Answerer
  • Yea I see a lot of bugs but it looks cool!

    I love coding. This is signature is 100% Original. :)

    Saturday, February 11, 2017 6:38 PM
  • How I would start, HVB568
    • Proposed as answer by YLedEditor Saturday, February 11, 2017 7:27 PM
    Saturday, February 11, 2017 6:48 PM
    Moderator
  • This is cool 

    Thanks


    I love coding. This is signature is 100% Original. :)

    Saturday, February 11, 2017 6:53 PM
  • Hi LitDev

    Fantastic your solution !!

    here is an update for replacing some colors: HVB568-0

    Saturday, February 11, 2017 7:27 PM
    Answerer
  • Looks nicer, I noticed a typo Exmples should be Examples
    Saturday, February 11, 2017 7:44 PM
    Moderator
  • @Litdev

    Would it be a good idea to add to the Jan-Feb Challenge this one:

    Small Challenges

    • Write a program to draw a balloon, but the ballon is getting bigger every 5 seconds, and maybe change colors while growing...



    • Edited by YLedEditor Saturday, February 11, 2017 7:54 PM
    Saturday, February 11, 2017 7:53 PM
    Answerer
  • @ YLed

    Sure, if you write it a short post for it I will make it sticky.

    Saturday, February 11, 2017 7:56 PM
    Moderator