#define's Profile User Rating: *****

Reputation: 1432 Grandmaster
Active Posts:
4,968 (2.33 per day)
19-February 09
Profile Views:
Last Active:
User is offline Dec 20 2014 09:33 PM

Previous Fields

Who Cares
OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Expert In:

Latest Visitors

Icon   #define has not set their status

Posts I've Made

  1. In Topic: Trying to create a function in a header file and getting two errors.

    Posted 20 Dec 2014

    No, the answer is simpler.

    A prototype is composed of the function name and parameters and return type.

    Have a look at how you construct the function head in the class, and how you defined it where you write the function.
  2. In Topic: Game is over before it begins

    Posted 20 Dec 2014

    When you use Check the first section returns a value if any figure is found. What is the purpose if that section?
  3. In Topic: Adding exception handling code to my calculate mortgage program.

    Posted 19 Dec 2014

    View Postmustangsally71, on 19 December 2014 - 06:06 AM, said:

    NOW!!! It skips over ALL the subsequent statements. GGGRRRRR!!!

    When does it do that? Is it all the time is it when you enter a comma? Is the comma at the start of a number or embedded?

    If a comma (or non-numeric character) is entered at the start of a number the cin stream will go into the fail state. The subsequent cin operations will not be performed, until the cin stream is cleared.

    If a comma is embedded in a number, the stream will not fail.

    You need to print out values to check them (and see what is happening) eg the principal and the state of cin - whether it has failed or not.

    There are various ways of getting and checking input. To check for commas in an number you could use peek as follows.

        // read principal
        cin >> myMortgage.Principal;
        // debug statement
        cout << "Principal=" << myMortgage.Principal << endl;
        cout << boolalpha;
        cout << "cin.fail()=" << cin.fail() << endl;
        // check for embedded comma
        char comma ',';
        if(cin.peek() == comma)
          throw 1;
      catch(int i)
        cout << "error - comma in input stream" << endl;
  4. In Topic: Adding exception handling code to my calculate mortgage program.

    Posted 18 Dec 2014

    You have two

    cin >> Mortgage.Principal;


    So you print an error when a comma is input?
  5. In Topic: Adding exception handling code to my calculate mortgage program.

    Posted 18 Dec 2014

    Does the code print error when you use a comma?

My Information

Member Title:
Duke of Err
Age Unknown
Birthday Unknown
Delta Quadrant
Years Programming:
Programming Languages:

Contact Information

Website URL:
Website URL  http://


Page 1 of 1
  1. Photo

    GryphonClaws Icon

    10 Jan 2013 - 01:15
    Thanks #define. I can't believe I missed such a simple detail.
  2. Photo

    raghav.naganathan Icon

    07 Nov 2012 - 20:40
    Dude...before your reputation changes, I would like to tell you that it(729) is a perfect cube :) Cheers :)
Page 1 of 1