Does your data file end with a newline? That is, after typing "12", do you hit the enter key?
When using eof( ) to test for end of data, that's usually a crucial requirement of the data file.
Try controlling your loop thusly:
while( Entrada >> num1 >> num2 )
{
//do the processing
}
If the read action is successful, you'll enter the loop body. However, in this form, youmust have an even number of data elements in the file.
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228