hi,
i was adding the two numbers in qtp scripts but i didn't get
the answer. see my below script, i dont know wht is the problem.

i passed the value a=3 b= 2, i got the ans 32 instead of 5.
i thing the problem is to be c = a+b

my mail id karthis4u@gmail.com

Dim a, b, c
a = inputbox("enter the a ")
b = inputbox("enter the b ")
c = a + b
print c

Answers were Sorted based on User's Feedback



hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / deepak singh

hi

Use CINT Function:: correct code is

Dim a, b, c
a =cint( inputbox("enter the a "))
b =cint( inputbox("enter the b "))
c = a + b
msgbox c


send mail if you have any query:

ccna_deepak@yahoo.com

Is This Answer Correct ?    21 Yes 2 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / rayudu

a= inputbox("Enter the value a")
b=inputbox("Enter the value b")
c=int(a)+int(b)
msgbox c

Is This Answer Correct ?    15 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / qa

hi

Use CINT Function:: correct code is

Dim a, b, c
a =cint( inputbox("enter the a "))
b =cint( inputbox("enter the b "))
c = a + b
msgbox c

Is This Answer Correct ?    8 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / praveen

Dim a, b, c

a =3
b =2
c = a + b
msgbox c

Is This Answer Correct ?    4 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / debee prasad kar

u have to use CINT function which is a conversion
function.If we not use this function then whatever we enter
in inputbox that will be treated as sting.so CINT function
converts from string to integer.
Code:
dim a,b,c
a= cint(inputbox("enter the first number"))
b= cint(inputbox("enter the second number"))
c=cint(a+b)
msgbox c

Is This Answer Correct ?    1 Yes 0 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / prasad v

hello
which ever the code you have written will be doing
cancatenation by accepting as characters.
if you provide inputs as a="abc" and b="xyz" then output
will be "abcxyz" right.

if you add two numbers you can go for this below code
function sum(a,b)
c=a+b
msgbox c
end function

calling the function
sum 2,3 then you will get output as 5

Is This Answer Correct ?    5 Yes 6 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / kavi

Hi,

prasad's code was right.. but we should pass values for the
function sum
dim a,b,c
function sum(a,b)
c=a+b
msgbox c
end function
x=sum(3,2)

Is This Answer Correct ?    2 Yes 4 No

hi, i was adding the two numbers in qtp scripts but i didn't get the answer. see my below sc..

Answer / ram

Dim a, b, c
a = inputbox("enter the a ")
b = inputbox("enter the b ")
c = a + b
msgbox(&c)

Is This Answer Correct ?    1 Yes 7 No

Post New Answer

More QTP Interview Questions

How to use Environment parameterization? Explain with an example.

0 Answers  


HI How to take screenshots of a Webpage and saving it in a external word document using QTP.

4 Answers   3i Infotech, TCS,


What are the main differences of qtp and win runner?

0 Answers  


Do you have any knowledge about Business Processing Testing in QTP

1 Answers   TCS,


how to count the word "IS" is repeated in the application using DP

3 Answers   DST Global Solutions,






Which property will you use to check the object state? (Exist)

2 Answers   Symphony,


How do function returns a value?How can we pass one function value to other function as input

3 Answers  


i have data in excel sheet.i imported the data in data table.while doing parameterization,how the code knows it is a valid or invalid data?

2 Answers   Fiserv,


For the below written code , i want to be stop the loop (ex:10 times), but it is focusing to first line of the code & generating error. vbwindow("vbname:=frmMain").Type micAltDwn + "6" + "2" + "D" +micAltUp 'wiil open the particular window in application vbwindow("vbname:=frmDeduction").vbbutton("vbname:=cmdNew").Click DataTable.ImportSheet"F:\QTP VBScript\Form 26-1.xls","Deduction",Global RowCount = DataTable.GetSheet("Global").GetRowCount i=RowCount For j =1 to i 'vbwindow("vbname:=frmDeduction").WinObject("nativeclass:=DataComboWndClass","abs_y:= 187").Type DataTable("Name", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 187").Type DataTable("Name", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 187").Type micF4 vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 187").Type micTab vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 216").Type micF4 vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 216").Type DataTable("Section", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 216").Type micTab vbwindow("vbname:=frmDeduction").VbEdit("vbname:=txtAmtOfPay").Set DataTable("Amount_of_Payment", dtGlobalSheet) vbwindow("vbname:=frmDeduction").VbEdit("vbname:=txtAmtPaidDate").Set DataTable("Amount_PaidCredited_Date", dtGlobalSheet) vbwindow("vbname:=frmDeduction").VbEdit("vbname:=txtAmtPaidDate").Type micTab vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 316").Type micF4 vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 316").Type DataTable("Deduction_is", dtGlobalSheet) vbwindow("vbname:=frmDeduction").ActiveX("acx_name:=DataCombo","abs_y:= 316").Type micTab vbwindow("vbname:=frmDeduction").VbButton("vbname:=cmdSave").Click DataTable.SetNextRow Next vbwindow("vbname:=frmDeduction").VbButton("vbname:=cmdClose").Click

0 Answers  


Can anyone share/send me QTP 8.2 Crack as I had it before but now it's virus affected. Pls send me on Sawale.vijay@gmail.com Thanks, ~Vijay

0 Answers   Zensar,


what is the test process followed for your project?

1 Answers   ADP, Satyam,


How comfortable are you in VB scripting?

2 Answers  


Categories