Correct my teacher

Pages: 12
NaN is short for "Not a Number", which is a possible result of dividing by zero, which in turn is a result of the read operations failing. What size in bytes is your dropout115.txt file?
Last edited on
That's a good point, can you copy and paste exactly what's in your .txt file or link to it.

Is it different from the sample data you gave? Because that worked.

After about 45 min. of figuring out how to use codeblocks and compile and run everything... It all worked with the "dropout115.txt" file within the same folder as the "main.cpp" and './a.out' ran the code no problem. The issue sounds like it's with your .txt file. Try a smaller block of data, like the section you gave us.

With:

35 4
42 4
27 3
36 5
1
2
3
4
5
root@bt:~/Desktop/ReadFrom2# ./a.out
Dropout rate from section 1: 0.114286
Dropout rate from section 2: 0.0952381
Dropout rate from section 3: 0.111111
Dropout rate from section 4: 0.138889


With no data in "dropout115.txt"
1
2
3
4
5
root@bt:~/Desktop/ReadFrom2# ./a.out
Dropout rate from section 1: -nan
Dropout rate from section 2: -nan
Dropout rate from section 3: -nan
Dropout rate from section 4: -nan


So that's Xcode on Mac OSx 10.8.2, Microsoft Visual Studio 2010 on Windows 7, and Codeblocks on Ubuntu. All ran fine.
Last edited on
Topic archived. No new replies allowed.
Pages: 12