Reading input file into value

Ok so I have been trying to figure this out forever. I am trying to read from my input file Transactions.data which is set up as follows
V 250190
A 250190 2008 4 8788.00 0.00 000
and so on and so forth. I am trying to read my V then go to switch (decision) to choose my case and preform further functions. My problem is that i cannot get past the first line so if it was
V 213400
V 123456
My code is supposed to check that the ID (213400) is valid then go on to the next line but it wont do that and prints out the first ID 6 times. My code is as follows (P.s. its just a snippit of the code)

char descision;
ifstream input;
input.open("Transaction.data");
if (input.fail()) { cout << "File could not be opened." << endl;}

input >> descision;
switch (descision)
{
case'V':

while (!input.eof()){

while (input >> descision){
if (tempID < 0 || tempID > 999999)
{

cout << tempID << "Not a valid ID" << endl;

}
else
{
cout << tempID << endl;
}

}
any help is appreciated
I don't see where you read the tempID. Suppose that you initialize it to 213400 somehow, then you read the decision as 'V', and then you read more characters, until the end of the file. Each time you rad a character (not the tempID), you check if tempID is valid (which it is), and you print it. But it's always the same number, since you don't change it
Topic archived. No new replies allowed.