struct listnode
{
int value;
string name;
double amount;
listnode*next;
};
typedef listnode *nodeptr;
int _tmain(int argc, _TCHAR* argv[])
{
nodeptr head = NULL;
ifstream bank("AcctNo.txt");
while ( !bank.eof() )
{
// make next object
nodeptr two = new listnode;
bank >> two->value;
bank >> two->name;
bank >> two->amount;
two->next = head;
// going back to the top
head = two;
}
bank.close();
// ask user
int value;
cout << "Enter account number :";
cin >> value;
nodeptr current = head;
bool found = false;
while ( current != NULL)
{
//do something with what current is pointing to
if ( current->value == value)
{
cout << current->name;
cout << current->amount;
found = true;
}
current = current->next;
}
if ( found == false)
cout << "smasher erased";
What's the question? We're not mind readers, and we're not gonna sit here and read through your code looking for an unknown error. We have better things to do.