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
Reply

Join Date: Nov 2006
Posts: 47
Reputation: sweety0 is an unknown quantity at this point 
Solved Threads: 0
sweety0 sweety0 is offline Offline
Light Poster

help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #1
Nov 27th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #2
Nov 27th, 2006
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 47
Reputation: sweety0 is an unknown quantity at this point 
Solved Threads: 0
sweety0 sweety0 is offline Offline
Light Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #3
Nov 27th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #4
Nov 27th, 2006
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 :

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim guesses As Integer
  2. guesses = 3
  3.  
  4. Private Sub Command1_Click()
  5. If Text1.Text = "secret" Then
  6. MsgBox "password is correct"
  7. Exit Sub
  8. Else
  9. guesses = guesses - 1
  10. MsgBox "password is incorrect. " & guesses & " remaining"
  11. End If
  12.  
  13. If guesses = 0 Then
  14. Me.Unload
  15. End If
  16.  
  17. 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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 47
Reputation: sweety0 is an unknown quantity at this point 
Solved Threads: 0
sweety0 sweety0 is offline Offline
Light Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #5
Nov 27th, 2006
hi thnx for the reply
first of all yes, i m using the vb 6 version.
now the problem related to this program is that
the constant "guesses" is not accepting the value 3
and the whole program is perfect but the only error is it is inot stoping on the 3 attempt.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #6
Nov 27th, 2006
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 47
Reputation: sweety0 is an unknown quantity at this point 
Solved Threads: 0
sweety0 sweety0 is offline Offline
Light Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #7
Nov 27th, 2006
hi thnx for the reply
first of all yes, i m using the vb 6 version.
now the problem related to this program is that
the constant "guesses" is not accepting the value 3
and the whole program is perfect but the only error is it is inot stoping on the 3 attempt.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #8
Nov 27th, 2006
Your new at this aren't you. come on paste the code I wanna fix it.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 47
Reputation: sweety0 is an unknown quantity at this point 
Solved Threads: 0
sweety0 sweety0 is offline Offline
Light Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #9
Nov 27th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 47
Reputation: sweety0 is an unknown quantity at this point 
Solved Threads: 0
sweety0 sweety0 is offline Offline
Light Poster

Re: help!! plz sum one help me FOR GOD SAKE i m crying give me solutions today

 
0
  #10
Nov 27th, 2006
Dim guesses As Integer

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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC