automatic terminate after 5 invalid entries

This is a discussion on automatic terminate after 5 invalid entries within the C Programming forums, part of the General Programming Boards category; I am doing an assignment which I have to write a program using a do statement that prompts for a ...

  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, 09:39 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21