Search Results

Search found 1 results on 1 pages for 'user3661876'.

Page 1/1 | 1 

  • Writing array to text file

    - by user3661876
    I have an array, but it won't write each index to the text file. Instead it is only writing the last index and the other indexes are not appearing. Can anyone help me to get the entire array printed to the text file? static void solve(int k) { if (k == N) // We placed N-1 queens (0 included), problem solved! { // Solution found! using (StreamWriter sw = new StreamWriter("names.txt")) { Console.Write("Solution: "); for (int i = 0; i < N; i++) { Console.Write(position[i] + " "); foreach (int s in position[i].ToString()) { string list = position[i].ToString(); sw.Write(list + " "); } } Console.WriteLine(); sum += 1; } }

    Read the article

1