Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
794 B
14
Indexable
Never
string convertToString(SCP obj) {
    // Student answer
    string result = "";
    //ID
    string id = to_string(obj.id);
    if(id.size() < 3)
        while(id.size() < 3) id = "0" + id;
        
    result = result + "Item #: SCP-" + id + "\n";
    if(obj.objClass == 0) result = result + "Object Class: Safe\n";
    else if(obj.objClass == 1) result = result + "Object Class: Euclid\n";
    else result = result + "Object Class: Keter\n";
    
    result = result + "Special Containment Procedures: " + obj.speConProcedures + "\n";
    result = result + "Description: " + obj.description + "\n";
    
    for(int i = 0; i < obj.numAddendums; i++)
    {
        result = result + obj.addendums[i] + "\n";
    }
    // result += obj.addendums[obj.numAddendums - 1];
    
    return result;
}