#include <iostream.h>
void initScreen()
{
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");
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");
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");
printf("Welcome to Bubbler, the Automated CAPA grader.\n");
printf("By: Guy Albertelli II\n");
printf("Version 0.10.00\n\n\n");
}
void getClassInfo(char* class,int* setId)
{
printf("What is the class name?");
scanf("%s",class);
printf("What is the SetId?");
scanf("%d",setId);
}
/*errr Guy this all needs some major thought put into it*/
void openOutputFile(filename[80], Questions questions[MAXQUEST],char* class,
int setId,char problem)
{
FILE *outputFile=fopen(filename,"r+");
/*File already exists*/
if (outputFile != NULL)
{
rewind(outputFile);
/*read in the first line with problem description etc.*/
fscanf(outputFile,"%s",buf);
}
/*File doesn't exist or is empty*/
if (outputFile==NULL || buf[0]=='\0')
{
outputFile=fopen(filename,"w+");
if (outputFile==NULL)
{
fprintf(stderr,"Unable to open the output file %s",filename);
exit(10);
}
fprintf(outputFile,"%s %d ",class,setId);
for(i=0;i<numQuestions;i++)
{
fprintf(outputFile,"%c%d",questions[i].type,questions[i].points);
}
fprintf(outputFile,"\n");
}
else
{
rewind(outputFile);
fscanf(outputFile,"%s %d %s",outputFileClass,outputFileSetId,
outputFileQuestions);
}
}
/* see comment above*/
void getProblemInfo(Question questions[MAXQUEST],char* class,
int setId,Flags* flags,FILE** outputFile)
{
char filename[80],buf[1024];
sprintf(filename,"bubbler.output.%d",setId);
outputFile=fopen(filename,"r+");
printf("Should I compare the class name and SetId with each paper?(y or n)");
scanf("%s",clear);
if (clear[0]=='N' || clear[0]=='n')
flags->CompareClassName=0;
else
flags->CompareClassName=1;
printf("Should the PIN be checked? (y or n)");
scanf("%s",clear);
if (clear[0]=='N' || clear[0]=='n')
flags->CheckPIN=0
else
{
CheckPIN=1;
printf("Should we run in Anonymous mode?");
scanf("%s",clear);
if (clear[0]=='N' || clear[0]=='n')
Anon=0;
else
Anon=1;
}
}
int main(void)
{
initScreen();
getClassInfo();
getProblemInfo();
setupScantron();
processForms();
closeScantron();
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>