| | |
help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2006
Posts: 47
Reputation:
Solved Threads: 0
Question # 1:
Ask the user to enter two different numbers. Print all the numbers between the two values they enter.
Question # 2:
Allow the user to enter as many as positive numbers as they wish, and enter zero to indicate they have finished. Then display the number of even values and number of odd values entered by the user. Hint: use the MOD operator to work out weather a number is odd or even.
Question # 3:
Allow the user to enter the password “secret” up to three attempts. Inform the user which attempt they are currently on (1, 2, and 3). Inform the user if the password is correct if they get it, otherwise inform the user the password is incorrect and exit the program.
Question # 4:
Ask the user to “Y”, “N”, “Q” (Quit) in response to this question. “Has” the user passed their driving test?” Continue asking this question until the user answers “Q”. Output the number and percentage of people who have passed their test.
Ask the user to enter two different numbers. Print all the numbers between the two values they enter.
Question # 2:
Allow the user to enter as many as positive numbers as they wish, and enter zero to indicate they have finished. Then display the number of even values and number of odd values entered by the user. Hint: use the MOD operator to work out weather a number is odd or even.
Question # 3:
Allow the user to enter the password “secret” up to three attempts. Inform the user which attempt they are currently on (1, 2, and 3). Inform the user if the password is correct if they get it, otherwise inform the user the password is incorrect and exit the program.
Question # 4:
Ask the user to “Y”, “N”, “Q” (Quit) in response to this question. “Has” the user passed their driving test?” Continue asking this question until the user answers “Q”. Output the number and percentage of people who have passed their test.
We won;t just do the whole thing for you here at DaniWeb. You must at least attempt to do it yourself and post your code when you get stuck then we will help you get it working.
These questions are obviously designed to demonstrate the basic constructs of structured programming Input, looping and decision making and outputing the result.
These questions are obviously designed to demonstrate the basic constructs of structured programming Input, looping and decision making and outputing the result.
•
•
Join Date: Nov 2006
Posts: 47
Reputation:
Solved Threads: 0
the code for third question is this
Private Sub Command1_Click()
If Text1.Text = "secret" Then
MsgBox "password is correct"
ElseIf Text1.Text <> "secret" Then
MsgBox "password is incorrect 1st time"
ElseIf Text1.Text <> "secret" Then
MsgBox "password is incorrect 2nd time"
ElseIf Text1.Text <> "secret" Then
MsgBox "password is incorrect 3rd time"
End If
End Sub
the code for question no. 4 is
Private Sub Command1_Click()
If Text1.Text = "Y" Then
MsgBox " yes the user has passed their driving test"
ElseIf Text1.Text = "N" Then
MsgBox " no the user has not passed the driving test"
ElseIf Text1.Text = "Q" Then
End
End If
End Sub
Private Sub Command1_Click()
If Text1.Text = "secret" Then
MsgBox "password is correct"
ElseIf Text1.Text <> "secret" Then
MsgBox "password is incorrect 1st time"
ElseIf Text1.Text <> "secret" Then
MsgBox "password is incorrect 2nd time"
ElseIf Text1.Text <> "secret" Then
MsgBox "password is incorrect 3rd time"
End If
End Sub
the code for question no. 4 is
Private Sub Command1_Click()
If Text1.Text = "Y" Then
MsgBox " yes the user has passed their driving test"
ElseIf Text1.Text = "N" Then
MsgBox " no the user has not passed the driving test"
ElseIf Text1.Text = "Q" Then
End
End If
End Sub
Ok first thing put [CODE][\code] (but with CODE in capitals, I have to do lower case otherwise they won't show in the post) tags around code in your posts please, makes it more readable. Thanx.
Ok I think in three what they want you to do is a global variable :
You should ba able to use similar idea for Q4 keep count of answers in two global integer variables failed and passed, increment them as per each yes and no answer. Add a label to your form and set it's text property to something like
I've not got VB6 anymore (I assume that's what you're using as your in Vb forum) So I can't check this code, if you get any errors post them word for word and I'll help best I can. Bear with me I am in a full time job and busy busy.
Ok I think in three what they want you to do is a global variable :
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim guesses As Integer guesses = 3 Private Sub Command1_Click() If Text1.Text = "secret" Then MsgBox "password is correct" Exit Sub Else guesses = guesses - 1 MsgBox "password is incorrect. " & guesses & " remaining" End If If guesses = 0 Then Me.Unload End If End Sub
You should ba able to use similar idea for Q4 keep count of answers in two global integer variables failed and passed, increment them as per each yes and no answer. Add a label to your form and set it's text property to something like
Label.text = failed & " People failed, " & passed & " People passed."I've not got VB6 anymore (I assume that's what you're using as your in Vb forum) So I can't check this code, if you get any errors post them word for word and I'll help best I can. Bear with me I am in a full time job and busy busy.
Last edited by hollystyles; Nov 27th, 2006 at 12:05 pm.
Is the message box with guesses remaining always say 3 remaining? or what? can you post your code as it now stands please? I'll see if I can work out your problem.
•
•
Join Date: Nov 2006
Posts: 47
Reputation:
Solved Threads: 0
Dim guesses As Integer (this is written in the declaration event)
Private Sub Command1_Click()
If Text1.Text = "secret" Then
MsgBox "password is correct"
Exit Sub
Else
guesses = guesses - 1
MsgBox "password is incorrect. " & guesses & " remaining"
End If
If guesses = 0 Then
End
End If
End Sub
now when i enter the wrong password it gives me msg box in which it is written " password is incorrect , -1 remaining"
then on the second attempt "password is incorrect,-2 remaining"
and keeps on increasing the remaining no.
i want that when i make a third attempt the program terminates.
Private Sub Command1_Click()
If Text1.Text = "secret" Then
MsgBox "password is correct"
Exit Sub
Else
guesses = guesses - 1
MsgBox "password is incorrect. " & guesses & " remaining"
End If
If guesses = 0 Then
End
End If
End Sub
now when i enter the wrong password it gives me msg box in which it is written " password is incorrect , -1 remaining"
then on the second attempt "password is incorrect,-2 remaining"
and keeps on increasing the remaining no.
i want that when i make a third attempt the program terminates.
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: need sample codes..
- Next Thread: thank u so much holly and veena
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows







come on paste the code I wanna fix it.