public void WriteInFile(string filename, MyQueue <string> result) { FileStream FS = new FileStream(filename, FileMode.OpenOrCreate); StreamWriter sw = new StreamWriter(FS); foreach (string element in result) { sw.Write(element + " "); } sw.Close(); FS.Close(); }
public MyQueue <string> Solution(MyQueue <string> queue, string element) { MyQueue <string> q2 = new MyQueue <string>(); int k = 0; foreach (string el in queue) { q2.Enqueue(el); if (Convert.ToInt32(el) % 2 == 0) { q2.Enqueue(element); } k++; } return(q2); }