cant get my program to work

so when i run the program the only thing that comes up is a blank screen and i cant figure out why?


// dfdf.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <cmath>
#include <cstdlib>

using namespace std;

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";

return 0;
}
Last edited on
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.
my bad so when i run the program the only thing that comes up is a blank screen and i cant figure out why?
Start commenting out lines until you get what you expect on screen.

I personally don't know what this is supposed to do but doesn't look right.

current = current->next;

Want more help, use code tags to format your code.
while ( !bank.eof() )

Is this condition ever getting met? Stick a breakpoint somewhere around there and see
Topic archived. No new replies allowed.