Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Comments in an Input File
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
corriep




PostPosted: Fri Dec 05, 2008 8:17 pm   Post subject: Comments in an Input File

Lets say I have an input file with >100 lines all full of numbers.

Is it possible to put comments in the input file that the program can't read? If not, is there an alternative?

Any help would be greatly appreciated.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Dec 05, 2008 8:49 pm   Post subject: RE:Comments in an Input File

Your program will read all of the input, but you can build the program in such a way that it ignores certain type of input. The design is really up to you.

A super easy solution (for this case) is to read everything in as a string, and then figure out if it's a number or anything else using strintok()
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
corriep




PostPosted: Fri Dec 05, 2008 9:29 pm   Post subject: RE:Comments in an Input File

Thanks tony!

Never even thought to use strint. The best part is that I don't have to use // or % or /* and */.

It seems so easy now.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: