Annotation of capa/capa51/Historic/newbub.c, revision 1.1
1.1 ! albertel 1: #include <iostream.h>
! 2:
! 3: void initScreen()
! 4: {
! 5: printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
! 6: printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
! 7: printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
! 8: printf("Welcome to Bubbler, the Automated CAPA grader.\n");
! 9: printf("By: Guy Albertelli II\n");
! 10: printf("Version 0.10.00\n\n\n");
! 11: }
! 12:
! 13: void getClassInfo(char* class,int* setId)
! 14: {
! 15: printf("What is the class name?");
! 16: scanf("%s",class);
! 17:
! 18: printf("What is the SetId?");
! 19: scanf("%d",setId);
! 20: }
! 21:
! 22: /*errr Guy this all needs some major thought put into it*/
! 23: void openOutputFile(filename[80], Questions questions[MAXQUEST],char* class,
! 24: int setId,char problem)
! 25: {
! 26: FILE *outputFile=fopen(filename,"r+");
! 27:
! 28: /*File already exists*/
! 29: if (outputFile != NULL)
! 30: {
! 31: rewind(outputFile);
! 32: /*read in the first line with problem description etc.*/
! 33: fscanf(outputFile,"%s",buf);
! 34: }
! 35:
! 36: /*File doesn't exist or is empty*/
! 37: if (outputFile==NULL || buf[0]=='\0')
! 38: {
! 39: outputFile=fopen(filename,"w+");
! 40: if (outputFile==NULL)
! 41: {
! 42: fprintf(stderr,"Unable to open the output file %s",filename);
! 43: exit(10);
! 44: }
! 45: fprintf(outputFile,"%s %d ",class,setId);
! 46: for(i=0;i<numQuestions;i++)
! 47: {
! 48: fprintf(outputFile,"%c%d",questions[i].type,questions[i].points);
! 49: }
! 50: fprintf(outputFile,"\n");
! 51: }
! 52: else
! 53: {
! 54: rewind(outputFile);
! 55: fscanf(outputFile,"%s %d %s",outputFileClass,outputFileSetId,
! 56: outputFileQuestions);
! 57: }
! 58: }
! 59: /* see comment above*/
! 60: void getProblemInfo(Question questions[MAXQUEST],char* class,
! 61: int setId,Flags* flags,FILE** outputFile)
! 62: {
! 63: char filename[80],buf[1024];
! 64:
! 65: sprintf(filename,"bubbler.output.%d",setId);
! 66: outputFile=fopen(filename,"r+");
! 67:
! 68: printf("Should I compare the class name and SetId with each paper?(y or n)");
! 69: scanf("%s",clear);
! 70: if (clear[0]=='N' || clear[0]=='n')
! 71: flags->CompareClassName=0;
! 72: else
! 73: flags->CompareClassName=1;
! 74:
! 75: printf("Should the PIN be checked? (y or n)");
! 76: scanf("%s",clear);
! 77: if (clear[0]=='N' || clear[0]=='n')
! 78: flags->CheckPIN=0
! 79: else
! 80: {
! 81: CheckPIN=1;
! 82: printf("Should we run in Anonymous mode?");
! 83: scanf("%s",clear);
! 84: if (clear[0]=='N' || clear[0]=='n')
! 85: Anon=0;
! 86: else
! 87: Anon=1;
! 88: }
! 89: }
! 90:
! 91: int main(void)
! 92: {
! 93: initScreen();
! 94: getClassInfo();
! 95: getProblemInfo();
! 96: setupScantron();
! 97: processForms();
! 98: closeScantron();
! 99: return 0;
! 100: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>