Input file format

Input file format

I just had a strange question about the input format of the txt files, but anyway, Is the input.txt ends without extra lines or columns? I mean the cursor at the end of the file is on the last integer value, not on a space or a new empty lineeg.i mean this1 2 3 45 6 7 89 0 1 2| <-- cursor at the end of filethnQ in Advance : )

8 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

From The Given Example in the Contest Description

[-10 -5 2 1 6

-5 10 50 60 -9]

It Appears That The Last Element(Number) in The Matrix Will Point To The End of The file..

Hope It Helps :)

The Contest Link:
http://software.intel.com/fr-fr/articles/Acceler8EN/

if i got u right
u r trying to read from the file and want to know where is the end of the file is ! am i right ?

there is no space or new line empty , it's just endline
if u use fstream , it will get it automaticly

aha, thanks abbadythe problem is that i found many people posting some testing files with this new line at the end of the file, so i felt some kind of suspicious :)

yes, i am using fstream, but when there is a new empty line at the end of the file, it increments the rows counter by 1, its an easy bug to fix, but i was making sure because some text files are generated for testing were having that new empty line :)thnQ for your help :)

I think the easiest way not to fail on the input is to handle both : with a last newline, and without. :)

i think the best way is to use getline(), it ignores the last line if it is empty

"Input
format : Natural integers (between -32000 and +32000) separated
by spaces, ended by a line break. All the lines have
the same number of natural integers."

This is what is said in the problem definition.
It says that the integers ended by aline break and it doesn't say except for the last line, so the last line also contains a new line before the eof.

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui