write/read from file(2)

I want my prog. to write to a file and then to read from the file for account names and passwords. how do i get it to write the input to a file and then, make it so it can read it in my begin. case?
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
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

	
	

int main() 
{
	ifstream inFile;  //input file
	ofstream outFile; //output file
	int name;
	int password;
	int Exit = 0;
	const int SENTINEL = Exit;
	char userSelect;

	
	cout <<"*******Final Project*******\n\n\n"<< endl;
	
		


	cout << "\n Please select from the three options.\n"
		 << "B to Begin\n"
         << "C to Create\n"
         << "E to Exit"
         << endl;
 
	 cin >> userSelect;
	
switch (userSelect)
	{
default:
	cout << " That is an invalid option." <<endl;
case 'C': case 'c':
	inFile.open("C:\accountname + pw.txt");

inFile >> name;
    cout << "Choose a Name you would like to use and type exit to quit.\n";
	 cin >> name;
	cout << " " <<endl;
	cout << "\n" <<endl;

inFile >> password;
	cout << "choose your password.";
	 cin >> password;
	cout << "\nChose your Race."<<endl;

	cout << "!Dwarf! !Orc! !Minotuar! !Human! !Elf!"<<endl;
inFile.close();
break;
	
case 'B': case 'b':
	
	cout << "Type in your user name\n."
		 << "Type in your password.\n"
		 << endl;
break;

case 'E': case 'e':
	cin >> exit;
}
	

return 0;
}
bump
Topic archived. No new replies allowed.