I have a program in which i open a a text file, access it's values and create and array with it. for example the text file may contain these values:
1 44 3 4 33 6 7 8 61 10
; that's 10 integers
what c++ tools could i use to count the number of integer values in the file? i want it so that it runs through the text file and counts 10 integers
teddyg18
0
Newbie Poster
Recommended Answers
Jump to PostI have a program in which i open a a text file, access it's values and create and array with it. for example the text file may contain these values:
1 44 3 4 33 6 7 8 61 10
; that's 10 integers
what c++ tools could i use …
Jump to PostIf you merely want a tool, doesn't Microsoft Word have a statistics page indicating number of words in a document? Open the file with that.
I use ASCII parsers all the time. ASE file readers, etc. I actually treat it as a gigantic ASCIIz buffer. Get File size allocate …
Jump to PostUnless your assignment required an array, you can merely sum their values until the last one was read then do the division for the averaging!
If it does require an array, you can do a two pass. Run it once to count the number of integers in the file. …
All 12 Replies
VernonDozier
2,218
Posting Expert
Featured Poster
wildgoose
420
Practically a Posting Shark
teddyg18
0
Newbie Poster
wildgoose
420
Practically a Posting Shark
VernonDozier
2,218
Posting Expert
Featured Poster
siddhant3s
1,429
Practically a Posting Shark
teddyg18
0
Newbie Poster
teddyg18
0
Newbie Poster
VernonDozier
2,218
Posting Expert
Featured Poster
teddyg18
0
Newbie Poster
VernonDozier
2,218
Posting Expert
Featured Poster
teddyg18
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.