File:  [LON-CAPA] / capa / capa51 / Historic / newbub.c
Revision 1.3: download - view: text, annotated - select for diffs
Mon Aug 7 20:47:29 2000 UTC (23 years, 10 months ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_12_X, version_2_11_X, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, version_2_0_X, version_2_0_99_1, version_2_0_2, version_2_0_1, version_2_0_0, version_1_99_3, version_1_99_2, version_1_99_1_tmcc, version_1_99_1, version_1_99_0_tmcc, version_1_99_0, version_1_3_X, version_1_3_3, version_1_3_2, version_1_3_1, version_1_3_0, version_1_2_X, version_1_2_99_1, version_1_2_99_0, version_1_2_1, version_1_2_0, version_1_1_X, version_1_1_99_5, version_1_1_99_4, version_1_1_99_3, version_1_1_99_2, version_1_1_99_1, version_1_1_99_0, version_1_1_3, version_1_1_2, version_1_1_1, version_1_1_0, version_1_0_99_3, version_1_0_99_2, version_1_0_99_1, version_1_0_99, version_1_0_3, version_1_0_2, version_1_0_1, version_1_0_0, version_0_99_5, version_0_99_4, version_0_99_3, version_0_99_2, version_0_99_1, version_0_99_0, version_0_6_2, version_0_6, version_0_5_1, version_0_5, version_0_4, stable_2002_spring, stable_2002_july, stable_2002_april, stable_2001_fall, release_5-1-3, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, conference_2003, bz6209-base, bz6209, STABLE, HEAD, GCI_3, GCI_2, GCI_1, CAPA_5-1-6, CAPA_5-1-5, CAPA_5-1-4_RC1, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
- fixed license notices the reference the GNU GPL rather than the GNU LGPL

    1: /* start at reimplementing bubbler
    2:    Copyright (C) 1992-2000 Michigan State University
    3: 
    4:    The CAPA system is free software; you can redistribute it and/or
    5:    modify it under the terms of the GNU General Public License as
    6:    published by the Free Software Foundation; either version 2 of the
    7:    License, or (at your option) any later version.
    8: 
    9:    The CAPA system is distributed in the hope that it will be useful,
   10:    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12:    General Public License for more details.
   13: 
   14:    You should have received a copy of the GNU General Public
   15:    License along with the CAPA system; see the file COPYING.  If not,
   16:    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   17:    Boston, MA 02111-1307, USA.
   18: 
   19:    As a special exception, you have permission to link this program
   20:    with the TtH/TtM library and distribute executables, as long as you
   21:    follow the requirements of the GNU GPL in regard to all of the
   22:    software in the executable aside from TtH/TtM.
   23: */
   24: 
   25: #include <iostream.h>
   26: 
   27: void initScreen()
   28: {
   29:   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");
   30:   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");
   31:   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");
   32:   printf("Welcome to Bubbler, the Automated CAPA grader.\n");
   33:   printf("By: Guy Albertelli II\n");
   34:   printf("Version 0.10.00\n\n\n");
   35: }
   36: 
   37: void getClassInfo(char* class,int* setId)
   38: {
   39:   printf("What is the class name?");
   40:   scanf("%s",class);
   41: 
   42:   printf("What is the SetId?");
   43:   scanf("%d",setId);
   44: }
   45: 
   46: /*errr Guy this all needs some major thought put into it*/
   47: void openOutputFile(filename[80], Questions questions[MAXQUEST],char* class,
   48: 		    int setId,char problem)
   49: {
   50:   FILE *outputFile=fopen(filename,"r+");
   51: 
   52:   /*File already exists*/
   53:   if (outputFile != NULL)
   54:     {
   55:       rewind(outputFile);
   56:       /*read in the first line with problem description etc.*/
   57:       fscanf(outputFile,"%s",buf);
   58:     }
   59:   
   60:   /*File doesn't exist or is empty*/
   61:   if (outputFile==NULL || buf[0]=='\0')
   62:     {
   63:       outputFile=fopen(filename,"w+");
   64:       if (outputFile==NULL)
   65: 	{
   66: 	  fprintf(stderr,"Unable to open the output file %s",filename);
   67: 	  exit(10);
   68: 	}
   69:       fprintf(outputFile,"%s %d ",class,setId);
   70:       for(i=0;i<numQuestions;i++)
   71:         {
   72:           fprintf(outputFile,"%c%d",questions[i].type,questions[i].points);
   73:         }
   74:       fprintf(outputFile,"\n");
   75:     }
   76:   else
   77:     {
   78:       rewind(outputFile);
   79:       fscanf(outputFile,"%s %d %s",outputFileClass,outputFileSetId,
   80: 	     outputFileQuestions);      
   81:     }
   82: }
   83: /* see comment above*/
   84: void getProblemInfo(Question questions[MAXQUEST],char* class,
   85: 		    int setId,Flags* flags,FILE** outputFile)
   86: {
   87:   char filename[80],buf[1024];
   88: 
   89:   sprintf(filename,"bubbler.output.%d",setId);
   90:   outputFile=fopen(filename,"r+");
   91:   
   92:   printf("Should I compare the class name and SetId with each paper?(y or n)");
   93:   scanf("%s",clear);
   94:   if (clear[0]=='N' || clear[0]=='n')
   95:     flags->CompareClassName=0;
   96:   else
   97:     flags->CompareClassName=1;
   98: 
   99:   printf("Should the PIN be checked? (y or n)");
  100:   scanf("%s",clear);
  101:   if (clear[0]=='N' || clear[0]=='n')
  102:     flags->CheckPIN=0
  103:   else
  104:     {
  105:       CheckPIN=1;
  106:       printf("Should we run in Anonymous mode?");
  107:       scanf("%s",clear);
  108:       if (clear[0]=='N' || clear[0]=='n')
  109: 	Anon=0;
  110:       else
  111: 	Anon=1;
  112:     }  
  113: }
  114: 
  115: int main(void)
  116: {
  117:   initScreen();
  118:   getClassInfo();
  119:   getProblemInfo();
  120:   setupScantron();
  121:   processForms();
  122:   closeScantron();
  123:   return 0;
  124: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>