Problem compiling a program

Hello everyone.Happy new year.
I have a problem compiling this program.
This program offers the user options such as
to create an account delete an account etc.
The accounts are stored in sinlge linked list.

Compile errors:

Error 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

Error 2 error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

I really don't understand.Any help would be appreciated
The code is below!

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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#include "stdafx.h"
#include <iostream>
#include <cstring>
using namespace std;



class account
{
    private:
        long account_num;
        string name;
        double money;
    public:
        account ();
        account (long accNum, string ClName, double AmMoney);
        void deposit(double AmMoney);
        void draft (double AmMoney);
        void display_account();
// operator overloading
	bool operator == (const account &Acc);
};

struct node
{
    account balance;
    struct node *next;
};

//---------------------------
account :: account()
{
    account_num = 0;
    name = "no name";
    money = 0;
}

account :: account(long accNum, string ClName, double AmMoney)
{
    account_num = accNum;
    name = ClName;
    money = AmMoney;
} 

bool account :: operator == (const account &Acc)
{
	if (this -> account_num == Acc.account_num
            && this -> money == Acc.money)
	{
		return true;
	}
	else
		return false;
}

void account :: deposit(double AmMoney)
{
    money += AmMoney;
}

void account :: draft(double AmMoney)
{
    if (AmMoney > money)
    {
        cout << "Your account does not have so many money\n";
        return ;
    }
    money -= AmMoney;
}

void account :: display_account()
{
    cout << "\tID : " << this -> account_num << endl;
    cout << "\tName : " << this -> name << endl;
    cout << "\tBalance : " << this -> money << endl;
}
 

//-----functions prototype-----
int menu();
void printList (struct node *start);
struct node *insert (struct node *start, account bal);// bal = balance to be inserted
struct node *erase (struct node *start, account bal);  // bal = balance to be deleted
struct node *search (struct node *start, account bal); // bal = balance to be found
struct node *FindPrev (struct node *start, account bal); // bal = balance whom previous is to be found

int _tmain(int argc, _TCHAR* argv[])
{
	struct node *head = NULL;
	string name;
	long Id = 1;
	double amount;
	int sel;

	do
	{
		sel = menu();
		switch (sel)
		{
		case 1:
		{
			cout << "Enter a name:";
			getline(cin, name);
			cout << "Enter amount of money:";
			cin >> amount;
			account newAcc(Id, name, amount);
			head = insert(head, newAcc);
			Id++;
			break;
		}
		case 2:
			break;
		case 3:
			printList(head);
			break;
		case 4:
			break;
		case 5:
			break;
		case 6:
			break;
		}
		system("pause");
	}while (sel != 6);
// delete the entire list
	while (head)
	{
		struct node *tmp = new struct node;
		tmp -> next = head -> next;
		delete head;
		head = tmp -> next;
		delete tmp;
	}
	return 0;
}


//-----------------function implementation----------------------
int menu()
{
    int choice;
    
    do
    {
        cout << "1.Create account\n";
        cout << "2.Delete account\n";
		cout << "3.Watch accounts\n";
        cout << "4.Make a deposit\n";
        cout << "5.Make a draft\n";
        cout << "6.Exit\n";
        cin >> choice;
	if (cin.fail() && !cin.bad())
	{
            cout << "Bad input!Enter an integer between 1-5\n";
	    cin.clear();
	    while (cin.get() != '\n') continue;
	}
    }while (choice < 1 || choice > 5);

	return choice;
}

// find the node in the list whose balance is equal to bal
struct node *search(struct node *start, account bal)
{
    int found = 0;
    if (start == NULL)
        return NULL; // there is no list
    
    struct node *tmp = start;
    while (tmp -> next != NULL && !found)
	{
		if (tmp -> balance == bal)
			found = 1;
		else
			tmp = tmp -> next;
	}

	if (found)
		return tmp;
	else
		return NULL; // balance not found
}

// find the previous node which balance is equal to bal
struct node *FinPrev (struct node *start, account bal)
{
	int found = 0;
	struct node *tmp = start;
	struct node *prev = NULL;
	while (tmp -> next != NULL && !found)
	{
		if (tmp -> balance == bal)
			found = 1;
		else
		{
			prev = tmp;
			tmp = tmp -> next;
		}
	}

	if (found)
		return prev;
	else
		return NULL;
}


// inserts a node to the list
struct node *insert (struct node *start, account bal)
{
    struct node *tmp = new struct node;

	if (!tmp)
	{
		cout << "Unable to allocate memory\n";
		cout << "Program will exit\n";
		exit(0);
	}
	if (start == NULL)
	{
		start -> balance = tmp -> balance;
		tmp -> next = start;
		start = tmp;
	}
	else
	{
		struct node *cur = start;
		while (cur -> next != NULL)
			cur = cur -> next;
		cur -> balance = tmp -> balance;
		cur -> next = tmp;
		tmp -> next = NULL;
	}

	return start;
}




// deletes an element from the list
struct node *erase (struct node *start, account bal)
{
	struct node *NodeToBeDel = search (start, bal);
	if (NodeToBeDel == NULL)
	{
		cout << "Account doesn't exist\n";
		return NULL;
	}
	struct node *prev = FindPrev(start, NodeToBeDel -> balance); // previous of NodeToBeDel
// delete the first element of the list
	if (prev == NULL)
	{
		struct node *tmp = new struct node;
		//tmp -> balance = start -> balance;
		tmp -> next = start -> next;
		delete start;
		start = tmp -> next;
		delete tmp;
		return start;
	}
// delete the last element of the list
	if (NodeToBeDel -> next == NULL)
	{
		delete NodeToBeDel;
		prev -> next = NULL;
		return start;
	}
// delete a node of the list
	struct node *tmp = new struct node;
	tmp -> balance= NodeToBeDel -> balance;
	tmp -> next = NodeToBeDel -> next;
	delete NodeToBeDel;
	prev -> next = tmp -> next;
	delete tmp;
	return start;
}


void printList(struct node *start)
{
	int i = 0;
	struct node *cur = start;
	while (cur)
	{
		cout << "Account " << i+1 << endl;
		cur -> balance.display_account();
		cur = cur -> next;
		i++;
		cout << "\n\n";
	}
	return ;
}
#include <string>
thanks Bazzy but now it has another compile error

Error 1 error LNK2019: unresolved external symbol "struct node * __cdecl FindPrev(struct node *,class account)" (?FindPrev@@YAPAUnode@@PAU1@Vaccount@@@Z) referenced in function "struct node * __cdecl erase(struct node *,class account)" (?erase@@YAPAUnode@@PAU1@Vaccount@@@Z) second.obj second
You have a typo on line 186, you forgot the 'd' in FindPrev
thanks a lot Bazzy.Problem solved
Topic archived. No new replies allowed.