0
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;
}

Edited by Reverend Jim: Fixed formatting

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Zhujy
0

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;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.