static void Main(string[] args) { const string cppFile = "#include \"iostream\"\n" + "using namespace std;\n\n" + "int main(int argc, char const *argv[])\n" + "{\n" + " cout << \"Hello world!\\n\";\n" + " return 0;\n" + "}\n"; Console.WriteLine("Problem number"); int number = Int32.Parse(Console.ReadLine()); Console.WriteLine("Folder output"); string folder = Console.ReadLine(); folder += "\\" + number.ToString(); Directory.CreateDirectory(folder); string url = "https://www.aceptaelreto.com/pub/problems/v00" + number / 100 + "/" + (number % 100).ToString("00") + "/st/problem.pdf"; using (var client = new WebClient()) { client.DownloadFile(url, folder + "\\problem.pdf"); } Console.WriteLine("Downloaded File"); Console.WriteLine("Choose file type: \n 1) c++ \n 2) java"); fileType choosenFile = (fileType)(Console.ReadKey(true).KeyChar - '0'); string file = ""; switch (choosenFile) { case fileType.cpp: file = cppFile; break; case fileType.java: file = javaFile(number); break; default: throw new Exception("Wrong file format"); } Console.WriteLine("Creating file"); StreamWriter sw = File.CreateText(folder + "\\problem" + number.ToString() + "." + choosenFile.ToString()); sw.Write(file); sw.Close(); Console.WriteLine("Written problem" + number.ToString() + "." + choosenFile.ToString()); Console.WriteLine("Press any key to exit..."); Console.ReadKey(true); }