mardi 28 juin 2016

C++ beginner - trying to write a function but getting a identifier...is undefined

I am a student and am tasked with creating a program that will determine if a person is rich or not. My code is below and I keep getting an error that identifier "isRich" is undefined. Can someone help me figure out where I went wrong?

EDIT assignment instructions removed, since the error is in the syntax, not the logic

#include "stdafx.h"
#include <iostream> //for input and output
#include "Cusick Project 5.h"
using namespace std;


void calcWealth(int age, long cash, int dependants, long debt)
{

cout << "Please enter your age: ";
cin >> age;
cout << "Please enter the amount of cash on hand: ";
cin >> cash;
cout << "Please enter the amount of dependents you have: ";
cin >> dependants;
cout << "Please enter the amount of money you owe";
cin >> debt;

bool isRich(int *age, long *cash, int *dependants, long *debt);
{
    long trueCash;
    bool status = false;

    trueCash = cash - debt;

    if (dependants == 0)
    {
        if (trueCash >= 1000000)
        {
            status = true;
        }
        else
            status = false;
    }

    else if (age < 40)
    {
        trueCash = trueCash - (dependants * 150000);
        if (trueCash >= 1000000)
        {
            status = true;
        }
        else
            status = false;
    }

    else if (age > 39 && age < 51)
    {
        trueCash = trueCash - (dependants * 75000);

        if (trueCash >= 1000000)
        {
            status = true;
        }
        else
            status = false;
    }

    else
    {
        trueCash = trueCash - (dependants * 25000);

        if (trueCash >= 1000000)
        {
            status = true;
        }
        else
            status = false;
    }
  }
}

int main()
{
    int age;
    long cash;
    int dependants;
    long debt;
    bool status; 

    cout << "Welcome to the wealth indicator..." << endl;

    calcWealth(age, cash, dependants, debt);

    if (isRich(status) = true)
    {
        cout << "Congratulations!  We consider you as being "rich."" <<     endl;
    }

    else
    {
        cout << "I am sorry!  You are not yet "rich."" << endl;
    }
}

Aucun commentaire:

Enregistrer un commentaire