Counting lines of code to print
Hello, I am currently working on an assignment where we are asked to use c# code to read student records from a file: StudentNo,Subject and mark. the tricky part is that for every line of code we print we should count and "print" on a new page when the line count reaches 60...anyone who can help, even if its just the logic in pseudocode il appreciate it
VulpesPosted Aug 10, 2011, 4:16 PM
Sam HobbsPosted Aug 11, 2011, 4:41 PM
VulpesPosted Aug 11, 2011, 4:10 PM
Sam HobbsPosted Aug 11, 2011, 3:45 PM
int count = 0;
using (StreamReader sr = new StreamReader("ncedisa.txt"))
{
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
count++;
if (count == 60)
{
count = 0;
Console.Write("\nPress any key to read next page");
// pause to read page
Console.ReadKey();
Console.Clear();
}
}
}
VulpesPosted Aug 11, 2011, 10:33 AM
Avuya MxoliPosted Aug 11, 2011, 10:11 AM
Sam HobbsPosted Aug 10, 2011, 6:25 PM
Note that the assignment is for doing something that programmers in the past would do very often, nearly every day. I assume that your iinstructor is as old as I (and maybe Vulpes) and is still using assignments from many years ago.