Pin Number modification

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
void edit_account()
{
	string newname, accno, newic, enterpin;
	string account_number[100],customer_name[100],date_create[100],ic[100],pin[100];
	int counter=0, choice,balance[100];

	

	fstream File;
	File.open ("Account.txt",ios::in);
	while(File){
		
		File>>account_number[counter];
		File.ignore();
		getline(File,customer_name[counter]);
		File>>pin[counter];
		getline(File,ic[counter]);
		getline(File,date_create[counter]);
		File>>balance[counter];
		counter++;
		
		}
	File.close();
	cout<<"Enter your account number:"<<endl;
	cin>>accno;
	cout<<"Enter your pin:"<<endl;
	cin>>enterpin;
	//cout<<"Do you want to edit your (1)name or your (2)IC? "<<endl;
	//cin>>choice;

	for(int a=0;a<counter;a++)
	{
		if (accno == account_number[a] && enterpin == pin[a])
		{
			cout<<"Do you want to edit your (1)name or your (2)IC? "<<endl;
			cin>>choice;

			if(choice == 1)
			{
				cout<<"Enter new name:"<<endl;
				cin.ignore();
				getline(cin,newname);
		
				for(int b=0;b<counter;b++)
				{
					if(accno == account_number[b])
					{
						customer_name[b]=newname;
						b=counter;
					}
				}

			}
			else if (choice == 2)
			{
				cout<<"Enter your new IC number"<<endl;
				cin>>newic;

				for (int c=0;c<counter;c++)
				{
					if(accno==account_number[c])
					{	
						ic[c]=newic;
						c=counter;
					}

				}
			}
		}
		else if (a==counter)
		{
			cout<<"haha"<<endl;
			break;
		}
	}
	
	File.open("Account.txt",ios::out);
	for(int d=0;d<counter;d++)
	{
		if(account_number[d] !="")
		{
			File<<account_number[d]<<endl;
			File<<pin[d]<<endl;
			File<<customer_name[d]<<endl;
			File<<ic[d]<<endl;
			File<<date_create[d]<<endl;
			File<<balance[d]<<endl<<endl;
		}
	}
	File.close();
	cout<<"Successfully updated"<<endl;
	system("pause");
}


I'm making function that would allow the user to view his account when he key in his pin number,and if the pin number is invalid, it will not display the account information.
But somehow even the pin number is entered correctly, it still won't display the account information



it still won't display the account information

Exactly where do you think you're displaying the account information?
I don't see any code that looks like it displays the account information.
Sorry, i think i posted the wrong code, however my senior helped me solve the problem :)
Sorry for the trouble
Topic archived. No new replies allowed.