void win_sort() { int n, n2, tmp; char tmpID[NUMREC]; for (n = 0; n < NUMREC - 1; n++) { for (n2 = n + 1; n2 < NUMREC; n2++) if (topStage[n] < topStage[n2] || (topStage[n] == topStage[n2] && topSteps[n] > topSteps[n2])) { strcpy(tmpID, topID[n]); strcpy(topID[n], topID[n2]); strcpy(topID[n2], tmpID); tmp = topStage[n]; topStage[n] = topStage[n2]; topStage[n2] = tmp; tmp = topSteps[n]; topSteps[n] = topSteps[n2]; topSteps[n2] = tmp; strcpy(tmpID, topFROM[n]); strcpy(topFROM[n], topFROM[n2]); strcpy(topFROM[n2], tmpID); strcpy(tmpID, prize[n]); strcpy(prize[n], prize[n2]); strcpy(prize[n2], tmpID); } } win_saverec(); clear(); printf("×£ºØ£¡ÄúË¢ÐÂÁË×Ô¼ºµÄ¼Í¼£¡\r\n"); pressanykey(); win_showrec(); }
void win_sort() { int n, n2, tmp; char tmpID[sizeof(topID[0])]; for (n = 0; n <= 18; n++) { for (n2 = n + 1; n2 <= 19; n2++) { if (topT[n] > topT[n2]) { tmp = topT[n]; topT[n] = topT[n2]; topT[n2] = tmp; strcpy(tmpID, topID[n]); strcpy(topID[n], topID[n2]); strcpy(topID[n2], tmpID); strcpy(tmpID, topFROM[n]); strcpy(topFROM[n], topFROM[n2]); strcpy(topFROM[n2], tmpID); strcpy(tmpID, prize[n]); strcpy(prize[n], prize[n2]); strcpy(prize[n2], tmpID); } } } win_saverec(); clear(); prints("×£ºØ! ÄúË¢ÐÂÁË×Ô¼ºµÄ¼Í¼!\r\n"); pressanykey(); win_showrec(); }
int win_checkrec(int dt) { char id[20]; int n; win_loadrec(); strcpy(id, userid); if(dt < 50){ clear(); prints("р╩йг╩ЗфВхк!!!\n╥ёдЦк╞цъ1╥жжс\n"); refresh(); sleep(60); pressanykey(); return 0; } for(n=0;n<20;n++) if(!strcmp(topID[n], id)) { if(stiger > topS[n]){ topS[n]=stiger; win_saverec(); } if(dt< topT[n]) { topT[n]= dt; strcpy(topFROM[n], fromhost); win_sort(); win_saverec(); } return 0; } if(dt<topT[19]) { strcpy(topID[19], id); topT[19]= dt; topS[19]= stiger; strcpy(topFROM[19], fromhost); win_sort(); win_saverec(); return 0; } return 0; }
int win_checkrec(int dt) { char id[20]; int n; win_loadrec(); strcpy(id, userid); for(n=0; n<=19; n++) if(!strcmp(topID[n], id)) { if(dt< topT[n]) { topT[n]= dt; strcpy(topFROM[n], fromhost); win_sort(); win_saverec(); } return; } if(dt<topT[19]) { strcpy(topID[19], id); topT[19]= dt; strcpy(topFROM[19], fromhost); win_sort(); win_saverec(); return; } }
int win_loadrec() { FILE *fp; int n; for(n=0; n<=19; n++) { strcpy(topID[n], "null."); topT[n]=999; strcpy(topFROM[n], "unknown."); } fp=fopen("mine2.rec", "r"); if(fp==NULL) { win_saverec(); return; } for(n=0; n<=19; n++) fscanf(fp, "%s %d %s\n", topID[n], &topT[n], topFROM[n]); fclose(fp); }
void win_loadrec() { FILE *fp; int n; for (n = 0; n < 20; n++) { strcpy(topID[n], "null."); topStage[n] = 0; topSteps[n] = 99999; strcpy(topFROM[n], "unknown."); strcpy(prize[n], "NA"); } fp = fopen(WORKERPATH "worker.rec", "r"); if (fp == NULL) { win_saverec(); return; } for (n = 0; n < 20; n++) fscanf(fp, "%s %d %d %s %s\n", topID[n], &topStage[n], &topSteps[n], topFROM[n], prize[n]); fclose(fp); }