All pastes #440798 Raw Edit

B7x0

public text v1 · immutable
·published 2007-04-15 09:18 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace MultipleDownloader
{
    class Program
    {
        static void Main(string[] args)
        {
            // Program will take the number of files to download and assign that value to integers m and n
            int y = int.Parse(args[0]);
            int m = y;
            int n = m;
            // creates a multidimentional array of the size [m,n]
           string[,] urlsPlusFiles = new string[m,n];

            /* using a 2 nested for loops, it will grab y URL's and y Files_names to be used as the names of downloaded files. 
             * it will store these inputs in the urlsPlusFiles multidimentional array created earlier. */ 

            for (int i =0; i < y; i++)
            {
               for (int j =0; j < y; j++)
               {
                   Console.WriteLine("For file # " + i + " Please enter the following...");
                   Console.Write("URL # " + i + ":");
                   string url = Console.ReadLine();
                   Console.Write("Name to be saved as:");
                   string name = Console.ReadLine();
                   
                   /* The compiler throws an error in the next line of code. Error: Cannot implicitly convert 
                    * type 'string[*,*]' to 'string.  How do i solve that??? */ 

                   urlsPlusFiles[i,j] = new string[,] { { url },{ name } };
                   j++;
                   break;
               }
            }
            // I need this step to make sure that the inputs has been stored succesfully in the array.
            foreach (string b in urlsPlusFiles)
            {
                Console.WriteLine(b);
            }
        }
    }
}