Need help: Homework 1.1 & 1.3

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

Need help: Homework 1.1 & 1.3

Postby branmask » Tue Mar 02, 2010 7:08 am

Hello all,
I've finished Project 1 except for the homework 1&3. On 1 I'm having trouble figuring out how to get the total of items to print. also, should it be under an "else if" of it's own or just under the last "else"? On 3 I think I should use the args==clear, File.Delete, & AppendAllText, but am not sure what else I need. Any pointers/suggestions would be most appreciated.
Thanks all
branmask
 
Posts: 14
Joined: Thu Feb 18, 2010 1:19 am

Postby Pidster » Tue Mar 16, 2010 5:26 pm

this is how i added in the first part

else{
var contents=File.ReadAllLines("todo.txt");
var counter=1;
Console.WriteLine("number of items :" +contents.Length);

foreach(var items in contents){

Console.WriteLine(counter+":"+items);
counter++;}

and the third part i guess i used extras not show in tutorial

else if (args[0]=="clear"){File.Delete("todo.txt");
File.Create("todo.txt");}

hope this helps, im still working on second part...
Pidster
 
Posts: 1
Joined: Tue Mar 16, 2010 4:59 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest