Unknown error(Exception thrown)


infile.get(ch2);
while (ch2 != '\n')
{
if (ch2 >= '0' && ch2 <= '9')
{
books[num_ele].ISBN += ch2;
infile.get(ch2);
}
else
infile.get(ch2);
}

Last edited on
@Travisboy, I suggest that you go back and re-think your post.

Please put your code in code tags so that we can read it.

Please ask an actual question so that we know what your problem is, rather than just dumping 355 lines of code with no indentation.

Please give us some input so that we can test your code and reproduce whatever problem you are having.

Please think about whether a title "Unknown error(Exception thrown)" is of any use whatsoever.



My COMPILER is only throwing up warnings about lines such as
books[num_ele].authors[i];
which don't do anything, but were probably meant to do something.

There's also plenty of opportunities for your code to fail with input: anything from simply not finding the input file and continuing regardless, to potential clashes between cin >> and getline( cin, ... ), to possibly using data from a failed input stream because you test the state of the stream before you read in and manipulate the data. We have absolutely no way of knowing ... you haven't given the necessary information.

As a general piece of advice, don't write 355 lines of code without checking it as you go along. Test each new function as you add it, not write the whole lot and then hope it works.
Last edited on
Topic archived. No new replies allowed.