hello guys,

i want to know how to write a program that can read txt file. example like this,

ClassAttendance1.txt and ClassAttendance1.txt contained Student ID number and name. i want to write a program that if i run the program will detect all ClassAttendance .txt and make a summary in percent.

Thank you

Recommended Answers

All 2 Replies

You could use ifstream to open the text file for reading.
From there, you use a loop with !filehandle.eof() as your condition to call getline for each line in the file as a string.

From there, you could split the string into substrings using stringstream and read each value delimited by space on the same line into separate variables that will be used for calculating %.

Sorry if I wasn't more detailed but I think I touched upon one approach you could use.

oh thanks, its make more clear.

Thank You

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.