Advertisement
SC0U7

uhuhu

Aug 21st, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace ConsoleApplication3
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             //Premenné
  15.             string subormeno;
  16.             string obsahsubora=null;
  17.             Boolean zapisuvat=true;
  18.             Boolean odznova = true;
  19.             // Show začína reku
  20.             Console.WriteLine("***********************");
  21.             Console.WriteLine("** Píčovina verzia 1 **");
  22.             Console.WriteLine("***********************");
  23.             while (odznova == true)
  24.             {
  25.                 Console.WriteLine("Zadaj nazov subora :");
  26.                 subormeno = Console.ReadLine();
  27.                 while (zapisuvat == true)
  28.                 {
  29.                     Console.WriteLine("Napis text ktorý chces pridat do suboru :");
  30.                     obsahsubora += Console.ReadLine();
  31.                     Console.WriteLine("Napisat zas? [ano/nie]");
  32.                     switch (Console.ReadLine())
  33.                     {
  34.                         case "ano":
  35.                             zapisuvat = true;
  36.                             break;
  37.                         default:
  38.                             zapisuvat = false;
  39.                             break;
  40.                     }
  41.                 }
  42.  
  43.                 if (File.Exists(subormeno + ".txt") == true)
  44.                 {
  45.                     Console.Beep();
  46.                     Console.WriteLine("Sorry takyto subor uz existuje");
  47.                 }
  48.                 else
  49.                 {
  50.                     using (FileStream fstream = new FileStream(subormeno+".txt", FileMode.CreateNew))
  51.                     {
  52.                         using (StreamWriter streamw = new StreamWriter(fstream))
  53.                         {
  54.                             streamw.WriteLine(obsahsubora);
  55.                         }
  56.                     }
  57.                 }
  58.                 Console.Beep();
  59.                 Console.WriteLine("Odznova? [ano/nie]");
  60.                 switch (Console.ReadLine())
  61.                 {
  62.                     case "ano":
  63.                           odznova = true;
  64.                           break;
  65.                     default:
  66.                           {
  67.  
  68.                               Console.WriteLine("--->Diky za pouzitie<---");
  69.                               Console.WriteLine("***********************");
  70.                               Console.WriteLine("***  Vytvoril SC0U7 ***");
  71.                               Console.WriteLine("***********************");
  72.                               odznova = false;
  73.                               break;
  74.                           }
  75.  
  76.                        
  77.  
  78.                 }
  79.             }
  80.             Console.ReadKey();
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement