예제 #1
0
int main(){
 
  Usuario user1("fuken1",1111,1),user2("fuken2",2222,1),
  user3("fuken3",3333,0),user4("fuken4",4444,0),
  usr5("",0,4);
  
  data_base db;
  int exito, exito2;
  
  exito = db.guardar_datos_usuario(user1);
  exito2 = db.guardar_datos_usuario(user3);
  cout << exito << endl;
  cout << exito2 <<endl;

  //db.guardar_datos_usuario(user2,"Estudiante");
  //db.guardar_datos_usuario(user3,"monitor");
  //db.guardar_datos_usuario(user4,"Monitor");
  //usr5 = db.cargar_datos_usuario(1111,"estudiante");
  //cout << usr5.get_name() << endl;
  //cout << usr5.get_id() << endl;
  //cout << usr5.get_rol() << endl;
  
  
  return 0;
}
예제 #2
0
BOOL cmd_program(IMP)
{
    register Ship_t *rsh;
    ULONG shNum;

    /* get the number of the ship */
    if (reqShip(IS, &shNum, "Ship to program"))
    {
        rsh = &IS->is_request.rq_u.ru_ship;
        server(IS, rt_readShip, shNum);
        if (rsh->sh_owner != IS->is_player.p_number)
        {
            user(IS, "You don't own that ship\n");
        }
        else if (rsh->sh_type == st_m)
        {
            user(IS, "Use the 'miner' command to program a miner\n");
            /* return FALSE since this could be a common mistake */
            return FALSE;
        }
        else
        {
            if (rsh->sh_course[0] != '\0')
            {
                user3(IS, "Current program: ", &rsh->sh_course[0], "\n");
            }
            uPrompt(IS, "Enter new program");
            if (clReadUser(IS) && (*IS->is_textInPos != '\0'))
            {
                server(IS, rt_lockShip, shNum);
                if (strcmp(IS->is_textInPos, "none") == 0)
                {
                    rsh->sh_course[0] = '\0';
                }
                else
                {
                    IS->is_textIn[MAX_PROG_STEPS - 1] = '\0';
                    strncpy(&rsh->sh_course[0], &IS->is_textIn[0],
                        (MAX_PROG_STEPS - 1) * sizeof(char));
                }
                server(IS, rt_unlockShip, shNum);
            }
            /* if there is a course, do some basic syntax checking */
            if (rsh->sh_course[0] != '\0')
            {
                checkCourse(IS, &rsh->sh_course[0]);
            }
        }
        return TRUE;
    }
    return FALSE;
}
예제 #3
0
void showError(IMP, char *course, char *where, char *desc)
{
    register char *p;

    p = course;
    userNL(IS);
    user2(IS, course, "\n");
    while (p != where)
    {
        userSp(IS);
        p += sizeof(char);
    }
    user(IS, "^\n");
    user3(IS, "Error: ", desc, "\n");
}