Annotation of capa/capa51/Historic/student_stats.c, revision 1.1
1.1 ! albertel 1: #ifdef NeXT
! 2: #include <stdlib.h>
! 3: #include <bsd/curses.h>
! 4: #else
! 5: #include <malloc.h>
! 6: double atof();
! 7: #include <curses.h>
! 8: #endif
! 9:
! 10: #include <stdio.h>
! 11: #include <ctype.h>
! 12: #include <sys/types.h>
! 13: #include <signal.h>
! 14: #include <math.h>
! 15: #include <string.h>
! 16:
! 17: #include "capaCommon.h"
! 18:
! 19:
! 20: main (int argc, char **argv)
! 21: {
! 22:
! 23: T_student *head_p, *c_p;
! 24: T_header a_header;
! 25: T_entry a_entry;
! 26: int student_cnt, set_idx;
! 27: int sec, set_scores, set_valids;
! 28: char *answers_p, wgt[128], pcr[128];
! 29: int MaxSec;
! 30: int MaxSet=9;
! 31: int total_scores, total_set_valids;
! 32: int count;
! 33: int *cnt_arry;
! 34: int inputNotOK=1;
! 35: char path[FILE_NAME_LENGTH];
! 36: char filename[FILE_NAME_LENGTH];
! 37: /* char classlist[FILE_NAME_LENGTH];
! 38: char studentclass[FILE_NAME_LENGTH]; */
! 39: char *classlist;
! 40: char *studentclass;
! 41: char *progname;
! 42:
! 43: if(argc>1) {
! 44: sec = atol(argv[2]);
! 45: } else {
! 46: sec =1;
! 47: }
! 48:
! 49: while ( inputNotOK ) {
! 50: puts("Enter the ABSOLUTE path of class");
! 51: scanf("%s", path);
! 52: if( access(path, F_OK) == -1 ) {
! 53: } else {
! 54: sprintf(filename,"%s/records",path);
! 55: if( access(filename, F_OK) == -1 ) {
! 56: puts("There isn't a records dir in this CLASS directory");
! 57: puts("Please Specify another calss");
! 58: } else {
! 59: inputNotOK = 0;
! 60: }
! 61: }
! 62: }
! 63:
! 64: chdir(path);
! 65:
! 66:
! 67: for (sec=1;sec<30; sec++){
! 68: if ((count=capa_get_section(&head_p,sec))>0)
! 69: MaxSec=sec;
! 70: }
! 71:
! 72: for (sec=1;sec<MaxSec;sec++){
! 73: student_cnt = capa_sorted_section(&head_p, sec, 2);
! 74: printf("Section #%d Set ",sec);
! 75: for (set_idx=1; set_idx<MaxSet; set_idx++) {
! 76: printf(" %2d ",set_idx);
! 77: }
! 78: printf(" Total\n");
! 79: for (c_p=head_p ; c_p ; c_p=c_p->s_next){
! 80: total_scores=0;
! 81: total_set_valids=0;
! 82: printf("%s (%s)",c_p->s_nm,c_p->s_sn);
! 83: for (set_idx=1; set_idx<MaxSet; set_idx++) {
! 84: set_scores = capa_get_score(c_p->s_sn,set_idx,&set_valids,&answers_p);
! 85: if (set_scores == -1) { /* never login to do assignments */
! 86: printf(" -",set_valids);
! 87: total_set_valids=total_set_valids+set_valids;
! 88: } else {
! 89: printf(" %2d",set_scores,set_valids);
! 90: total_scores=total_scores+set_scores;
! 91: total_set_valids=total_set_valids+set_valids;
! 92: }
! 93: capa_mfree(answers_p);
! 94: }
! 95: printf(" %3d/%3d \n",total_scores,total_set_valids);
! 96: }
! 97:
! 98: printf("Total students = %d\n\n\n",student_cnt);
! 99: free_students(head_p);
! 100: }
! 101:
! 102: }
! 103:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>