• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help in This Looping program!  RSS feed

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello i need help in this program, actually it is a quiz program, i want it to ask a question then user can answer it if user mistakes 3 time then program will exit otherwise continue questioning if correct answer accurs then program provide another question!

 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, um, er,... what actually is your question? It's hard to help without you posting one.
 
Muzafar Ali
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pete stein wrote:So, um, er,... what actually is your question? It's hard to help without you posting one.



Sorry for that


This is a quiz program
first it asks question from user
if user gives wrong answer the program will keep track of wrongs untill they reached on 3
then program will exit
if user is giving right answer program should proceed another question to him.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muzafar Ali wrote:
pete stein wrote:So, um, er,... what actually is your question? It's hard to help without you posting one.

Sorry for that
This is a quiz program
first it asks question from user
if user gives wrong answer the program will keep track of wrongs untill they reached on 3
then program will exit
if user is giving right answer program should proceed another question to him.

Sorry if I'm sounding picky, but your still just posting your assignment and not asking a true question. A question addresses what precisely don't you understand? What isn't working right?

You may wish to read the FAQs here on how to ask a question. I know that they have helped me with my posts quite a bit: How To Ask Questions On Java Ranch
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing that your question is: my code doesn't work at all, and in fact it doesn't. One problem I see is that you need to think through your programming steps on paper before committing them to code. Do that in this situation and the solution will fall out from it.

Also, here:


You create a for loop that uses the int "question" as the loop's index. You then change the index from within the loop with
This will cause many unwanted side effects. you should use an index that you look at but don't touch within the loop (unless you really know what you are doing and why you want to do it this way).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!