problems with answer files please help!

Hi, i was wondering if any one could help me, i am trying to write a questionnaire using c++, when people do the questions an answer file is created for that person and then at the end of the questionnaire i want the answers to be displayed on the command console,

the thing is that i have a counter which creates 10 answer files so 10 people can do the questionnaire so each answer file has a different name e.g A1,A2... etc this makes it hard for me to display the answers in the command console here is my code so far:
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
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>

int main()
{
    system("COLOR f0");
	char question[200],choice,answer,filename[5],ch_num[10];
	int c=1;
	do
    {
        ifstream fin("questions.txt");   

        do
        {
            system("cls");
            
            
    		if (!fin.eof())
    		{
                fin.getline(question,200);
    			cout << question << " ";
    			answer=getche();
    			strcpy(filename,"A");
    			itoa(c,ch_num,10);
    			strcat(filename,ch_num);
    			strcat(filename,".txt");
    			ofstream fout(filename,ios::app);
    			fout << answer << endl;
    			
          }
    	}while(!fin.eof());
        fin.close();
        cout << "Again? (Y/N)";
        choice=getch();
        cout<<endl;
        c++;
        }while(choice=='y'); 
     if(choice=='n');
     {
        
        
        
       do
        {
        ifstream fin(filename);
       fin.getline(cin,filename);
        if (answer == 'a')
           cout<<"*"<<endl;
		if (answer == 'b')
           cout<<"+"<<endl;
        if (answer == 'c')
           cout<<"@"<<endl;
        if (answer == 'd')
           cout<<"~"<<endl;
        if (answer == 'e')
           cout<<"#"<<endl;
}while (!fin.eof());	
	fin.close();
}
	getch();
	return 0;
}


im sorry its a bit of a mess, any help with this will be brilliant thanks alot.
Topic archived. No new replies allowed.