Thread: automatic terminate after 5 invalid entries

  1. #1
    ZeeeD
    Guest

    Unhappy automatic terminate after 5 invalid entries

    I am doing an assignment which I have to write a program using a do statement that prompts for a grade between 0 and 100, then displays the grade, alerts when an invalid grade is entered, exit the program when 999 is entered and terminates after 5 invalid grades have been entered. I have done all the assignment except I cant find my way around the terminates after 5 invalid entries. Can anyone point me in the right direction?? Thanks

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    errmmm very very difficult..... *thinks for an hour or two*

    Use a variable for invalid reads incrementing it after every bad read and check it for 5 invalid reads. If so use exit(0) to end the program.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Nested loop frustration
    By caroundw5h in forum C Programming
    Replies: 14
    Last Post: 03-15-2004, 09:45 PM
  5. Flood of errors when include .h
    By erik2004 in forum C++ Programming
    Replies: 14
    Last Post: 12-07-2002, 07:37 AM