Mistři v programování na #hovnokod

C/C++ #829

Rachel wrote, "This method was part of the State class. Apparently if you want to know what index NY is, you need to create a copy of the State class and call it's .get_state_index() method."

private int get_state_index(string state) {
    if(state == "AL")         return 0;
    if(state == "AK")        return 1;
    if(state == "AZ")        return 2;
    if(state == "AR")        return 3;
    if(state == "CA")        return 4;
    if(state == "CO")        return 5;
    if(state == "CT")        return 6;
    if(state == "DE")        return 7;
    if(state == "FL")        return 8;
    if(state == "GA")        return 9;
    if(state == "HI")        return 10;
    if(state == "ID")        return 11;
    if(state == "IL")        return 12;
    if(state == "IN")        return 13;
    if(state == "IA")        return 14;
    if(state == "KS")        return 15;
    if(state == "KY")        return 16;
    if(state == "LA")        return 17;
    if(state == "ME")        return 18;
    if(state == "MD")        return 19;
    if(state == "MA")        return 20;
    if(state == "MI")        return 21;
    if(state == "MN")        return 22;
    if(state == "MO")        return 23;
    if(state == "MT")        return 24;
    if(state == "NE")        return 25;
    if(state == "NV")        return 26;
    if(state == "NH")        return 27;
    if(state == "NJ")        return 28;
    if(state == "NM")        return 29;
    if(state == "NY")        return 30;
    if(state == "NC")        return 31;
    if(state == "ND")        return 32;
    if(state == "OH")        return 33;
    if(state == "OK")        return 34;
    if(state == "OR")        return 35;
    if(state == "PA")        return 36;
    if(state == "RI")        return 37;
    if(state == "SC")        return 38;
    if(state == "SD")        return 39;
    if(state == "TN")        return 40;
    if(state == "TX")        return 41;
    if(state == "UT")        return 42;
    if(state == "VT")        return 43;
    if(state == "VA")        return 44;
    if(state == "WA")        return 45;
    if(state == "WV")        return 46;
    if(state == "WI")        return 47;
    if(state == "WY")        return 48;
    if(state == "MS")        return 49;
    if(state == "PR")        return 50;
    return 51;
}

Anonymous,