|
-
Dec 9th, 2002, 12:13 PM
#1
Thread Starter
Frenzied Member
Messed up output...
Here's my code:
int InputCase(char f[19],char stuid[7],char key[19],int Score){
int y=0;
char e;
int n=0;
int r=0;
FILE *in;
in = fopen(stuid,"r");
if (in!=NULL){
while(fscanf(in,"%c",&e)!=EOF){
f[n]=e;
n++;
}
close(in);
}
else{
printf("Student answer file does not exist.\n");
}
}
int main(){
int x=0;
int n=0;
char a[19];
char s[7];
char sa[19];
printf("Please enter a student id to test: ");
scanf("%s",&s);
InputKey(a);
InputCase(sa,s,a,x);
printf("The Student ID was: %s\n",s);
printf("The key answers are: %s\n",a);
printf("The student answers are: %s\n",sa);
printf("The number of correct answers is: %d\n",x);
}
Here's the output:
[engr26@boole engr26]$ grader
Please enter a student id to test: STU08583
The Student ID was: STU08583
The key answers are: abcdefghijklmnopqrstuvwxyz
@4®@Lk@„üÿ¿
The student answers are: abcdefghijklmnopqrstuvwxyz
@Ès@STU08583
The number of correct answers is: 0
Now, the prog is loading the data from file correctly, but it's printing the wierd bolded stuff that isn't supposed to be there... why??
thanx in advance for your help...
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|