Potato_Boy🦉
❔ Help with code
Hello i am a bit of a beginner in c# and i would like to get some guidance with some work i have from school . So basically i have this little line of code
using System; using System.Collections.Generic; using System.IO; namespace SelectionCandidat { class Program { static void Main(string[] args) { /* Get data from input file */ var data = new List<String>(); string line; while ((line = Console.ReadLine()) != null) { data.Add(line); } // ADD YOUR CODE HERE } } } and basically on the software we can run different text files and the output should be a txt file too but i don't know how to interact with the data from the txt files that inside look like this 5 0,0 3 r u u So basically the first line is the size of the grid x,y Second line is the coordinates on that grid first is x second is y Third line is the number of instructions and the last lines are the instuctions that move though the grid so u is up and y does +1 d is for down and y does -1 l l or Left is -1 to x and r or right is +1 to x . i know how to do it with the terminal but with the txt files i am having an issues . Thanks for your time .
using System; using System.Collections.Generic; using System.IO; namespace SelectionCandidat { class Program { static void Main(string[] args) { /* Get data from input file */ var data = new List<String>(); string line; while ((line = Console.ReadLine()) != null) { data.Add(line); } // ADD YOUR CODE HERE } } } and basically on the software we can run different text files and the output should be a txt file too but i don't know how to interact with the data from the txt files that inside look like this 5 0,0 3 r u u So basically the first line is the size of the grid x,y Second line is the coordinates on that grid first is x second is y Third line is the number of instructions and the last lines are the instuctions that move though the grid so u is up and y does +1 d is for down and y does -1 l l or Left is -1 to x and r or right is +1 to x . i know how to do it with the terminal but with the txt files i am having an issues . Thanks for your time .
21 replies