Advertisement
finySTAR

2011erettsegi

Apr 9th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 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 szojatek
  9. {
  10.     class Program
  11.     {
  12.         public static bool maganhangzo_e(char betu)
  13.         {
  14.             char[] karakter_tomb = { 'a', 'e', 'i', 'o', 'u' };
  15.             for (int i = 0; i < karakter_tomb.Length; i++)
  16.             {
  17.                 if (karakter_tomb[i]==betu)
  18.                 {
  19.                     return true;
  20.                 }
  21.  
  22.             }
  23.             return false;
  24.         }
  25.         static void Main(string[] args)
  26.         {
  27.             Console.WriteLine("1.Feladat");
  28.             Console.Write("Adjon meg egy szót: ");
  29.             string megadott_word =Console.ReadLine();
  30.             if (megadott_word=="a"|| megadott_word=="e"||megadott_word=="i"||megadott_word=="o"||megadott_word=="u")
  31.             {
  32.                 Console.WriteLine("Van benne magánhangzó");
  33.             }
  34.             else
  35.             {
  36.                 Console.WriteLine("Nincs benne magánhangzó");
  37.             }
  38.            
  39.             Console.WriteLine("2.Feladat");
  40.             StreamReader olvas = new StreamReader(@"C:\Users\Diak\Desktop\e_infofor_11maj_fl\Forrasok\4_Szojatek\szoveg.txt", Encoding.Default);
  41.             List<string> szavak = new List<string>();
  42.             while (!olvas.EndOfStream)
  43.             {
  44.                 szavak.Add(olvas.ReadLine());
  45.             }
  46.             int max = szavak[0].Length;
  47.             string szo=szavak[0];
  48.             for (int i = 0; i < szavak.Count; i++)
  49.             {
  50.                 if (max < szavak[i].Length)
  51.                 {
  52.                     max = szavak[i].Length;
  53.                     szo = szavak[i];
  54.                     Console.WriteLine("A leghosszabb szó:{0}",szo);
  55.                 }
  56.             }
  57.             Console.WriteLine("3.Feladat");
  58.             for (int i = 0; i < szavak.Count; i++)
  59.             {
  60.                 foreach (var c in szavak[i].ToCharArray())
  61.                 {
  62.                     if (maganhangzo_e(c))
  63.                     {
  64.                        
  65.                     }
  66.                 }
  67.             }
  68.             Console.ReadLine();
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement