Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Premenné
- string subormeno;
- string obsahsubora=null;
- Boolean zapisuvat=true;
- Boolean odznova = true;
- // Show začína reku
- Console.WriteLine("***********************");
- Console.WriteLine("** Píčovina verzia 1 **");
- Console.WriteLine("***********************");
- while (odznova == true)
- {
- Console.WriteLine("Zadaj nazov subora :");
- subormeno = Console.ReadLine();
- while (zapisuvat == true)
- {
- Console.WriteLine("Napis text ktorý chces pridat do suboru :");
- obsahsubora += Console.ReadLine();
- Console.WriteLine("Napisat zas? [ano/nie]");
- switch (Console.ReadLine())
- {
- case "ano":
- zapisuvat = true;
- break;
- default:
- zapisuvat = false;
- break;
- }
- }
- if (File.Exists(subormeno + ".txt") == true)
- {
- Console.Beep();
- Console.WriteLine("Sorry takyto subor uz existuje");
- }
- else
- {
- using (FileStream fstream = new FileStream(subormeno+".txt", FileMode.CreateNew))
- {
- using (StreamWriter streamw = new StreamWriter(fstream))
- {
- streamw.WriteLine(obsahsubora);
- }
- }
- }
- Console.Beep();
- Console.WriteLine("Odznova? [ano/nie]");
- switch (Console.ReadLine())
- {
- case "ano":
- odznova = true;
- break;
- default:
- {
- Console.WriteLine("--->Diky za pouzitie<---");
- Console.WriteLine("***********************");
- Console.WriteLine("*** Vytvoril SC0U7 ***");
- Console.WriteLine("***********************");
- odznova = false;
- break;
- }
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement