E
E
Eugene2018-10-05 17:25:29
VBScript
Eugene, 2018-10-05 17:25:29

How to define data subtype in VBS?

Learning to program with VBS? I'm solving a problem in which you need to write a simple function to determine the largest of 3 numbers entered by the user. I wanted to enter a condition that will be met if the data entered by the user is not a number or cannot be converted to a number. I can't figure out how to do it.
Thank you!
Here is what is now:

Option Explicit

Function Task(a,b,c, result) 'Функция, которая записывает наибольшее число в переменную result
  If a>b And a>c Then
  result = a
  ElseIf b>a And b>c Then
  result = b
  ElseIf c>a And c>b Then
  result = c
  Else
  result = 0
  End If
End Function

Dim x,y,z,result
x = CDbl(InputBox("Введите первое число","Задача"))
y = CDbl(InputBox("Введите второе число","Задача"))
z = CDbl(InputBox("Введите третье число","Задача"))


Call Task(x,y,z,result)

If result<>0 Then 
  MsgBox "Самое большое число: "&result
Else
  MsgBox "Условия не соблюдены",,"Задача"
End If

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question