Homework help for a program that grades a multiple choice exam?? Thanks!

Hello World! (ha) This is my first post to this site. I am desperate because my code is due at midnight, and I can't seem to find a helpful example of the assignment I'm working on. My teacher is foreign and sucks at teaching, so bear with me.

I have to write a program to grade a multiple choice exam. This is the input file with the key at the top, student ids and their answers:(data5.1)
1
2
3
4
5
6
7
abcdefabcdefabcdefab
c1234567 abcdefabcdefabcdefab
c1234566 aaaaaaaaaaaaaaaaaaaa
c1234565 abcdefabcdefabcdefaa
c1234564 abcdefabcdefabcdef
c1234563 abcdefabcdefabcdefabbb
c1234562 abcdefabcdefabcdxxab

So I'm trying to figure out how to output this:

Enter the input file name: data5.1
Key:abcdefabcdefabcdefab
c1234567 abcdefabcdefabcdefab 20
c1234566 aaaaaaaaaaaaaaaaaaaa 4
c1234565 abcdefabcdefabcdefaa 19
c1234564 abcdefabcdefabcdef Too few answers
c1234563 abcdefabcdefabcdefabbb Too many answers
c1234562 abcdefabcdefabcdxxab Invalid answers

There are 6 student records.

.....This is my code so far. Any help is appreciated. I need an eof controlled loop, 3 functions (void, int, and bool)&of course int main...Thanks!!!!!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()

{
		ifstream myIn;			//declare variables
		string answers;
		int count=0;
		string fileName;
		string key;
		string SID;
	
	
	/*******************************************************************
	Function Purpose: Print the purpose of the program
	Parameters: None
	Pre-condition: None
	Post-condition: The purpose of the program is printed
	********************************************************************/
	void PrintPurpose();
	{

	cout<<"***************************************************************"<<endl;
	cout<<"The purpose of the program is to grade a multiple choice exam"<<endl;
	cout<<"based on a user input file."<<endl;
	cout<<"***************************************************************"<<endl;
	cout<<endl;
	
	}
	
	
	
	/**********************************************************************
	This section will receive user input and print an error message if the 
	data file DNE. It also counts the number of student records.
	************************************************************************/
	
	cout<< "Enter the input file name: "<<endl;
	
	cin>>fileName;
	
	myIn.open(fileName.c_str());
	
	while(! myIn)
	{
		cout<< fileName << " does not exist. Enter the input file name:  "<<endl;
	
	cin>>fileName;
	
	myIn.open(fileName.c_str());
	
	}
	
	
	
	myIn>>key;
	cout<<"Key: "<<key<<endl;
	cout<<endl;
	myIn>>SID;
		myIn>>answers;
	while(myIn)
	{
		
		
		count++;
		cout<<SID<<"\t"<<answers<<endl;
		myIn>>SID;
		myIn>>answers;
		
	}
		
	
	
	
	
	/*******************************************************************
	Function Purpose: Grades the student answers using the keys and returns
					  how many are correct.
	Parameters: ?
	Pre-condition: ?
	Post-condition: ?
	********************************************************************/
	int GradeMCExam(string keys, string answers);
	{
		
		
	}
	/*********************************************************************
	Function Purpose: Check to see if any of the student answers are invalid
	Parameters: string answers: string contains student's answer
	Pre-condition: each character in the answers string contains and answer 
				   to the corresponding exam question
	Post-condition: the validity of the answers is determined and returned
	**********************************************************************/
	bool InvalidAnswers(string key, string answers);
	{
		//length(), getline(), substr(), find()?????? STD LIBRARY FUNCTIONS
		

	

	}
		
		
	
	
	
		
		
		
	
	
		if (answers.length()>20)
		{	
			cout<<"Too many answers"<<endl;
		}
		else if (answers.length()<20)
		{
			cout<<"Too few answers"<<endl;
		}
	
	
	cout<<endl;
	cout<<"There are "<<count<< " student records."<<endl;
	
return 0;	
}


Any help is appreciated!
*bump* This is due at midnight. I can turn it in late with little penalty but i wanna get it done tonight. Thank you so much!
Topic archived. No new replies allowed.