yeah that removed the error but it is giving me unknown unexpected results.....moreover i am failing to understand the reason of your correction....means why should it be numb.c_str()
.c_str() is a function in the string class.
It changes the string to a C style string (an array to a pointer to string) that was declared as: char *numb[]
You should make the following changes in the code you posted above:
1. You can remove .c_str() from line 18.
2. Why have you made the for loop on line 15 with i = 1 & i <=1?
3. Instead of checking for End of File (on line 19), it will be better to use fin.good().
4. Why have you declared flag & i twice? Once on line 13 and again in the for loop in line 21 & line 15?
5. You need not have the while loop on line 23. I guess it would be better to use a if statement.
each number is on a seperate line...so ineed to read the complete number....
That is done by the for loop. By adding the while loop, you are increasing the number of iterations of the loop 100 times.
Say there are 10 lines. in the file.
If you run the program, it will repeat the process many 1000 times.