string rating(bool ozone, bool no2, bool so2)
{
    string result;
    int count = 0;


    if(ozone == true)
    {
        count++;
    }

    if(no2 == true)
        count++;
    if(so2 == true)
        count++;
    if(count == 3)
        result = "Gold Star";
    if(count == 2)
        result = "Silver Star";
    if(count == 1)
        result = "Ok";
    if(count == 0)
        result = "Failing";

    return result;

}

bool in_compliance(float standard, float first, float second, float third)
{
    int count = 0;

    if(first <= 0 || second <= 0 || third <=0)
        return false; 


    if(standard >= first)
        count++;
    if(standard >= second)
        count++;
    if(standard >= third)
        count++;
    if(count >= 2)
        return true;
    else
        return false;
}

Recommended Answers

All 2 Replies

One site rule use CODE TAGS, two inFile >> fileName; ? I just stopped reading there.

notice this in your code

// inFile is a file input stream, and it havn't open a file yet, so you got the error
inFile >> fileName;

I guess you wanna this:

// read user input fileName from command line
cin >> fileName;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.