Advertisement
GraionDilach

Alfüggvényes számkereső

Nov 28th, 2011
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string Line;
  13.             Console.WriteLine("Kérek egy sort:");
  14.             do
  15.             {
  16.                 Line = Console.ReadLine();
  17.             } while (Line.Length == 0);
  18.  
  19.             bool SzámKeres = NumberSearch(Line);
  20.             if (SzámKeres)
  21.             {
  22.                 Console.WriteLine("A sorban volt szám.");
  23.             }
  24.             else
  25.             {
  26.                 Console.WriteLine("A sorban nem volt szám.");
  27.             }
  28.         }
  29.  
  30.         static bool NumberSearch(string Sor)
  31.         {
  32.             for (int i = 0; i < Sor.Length; i++)
  33.             {
  34.                 if (Sor[i] >= '0' && Sor[i] <= '9'){
  35.                     return true;
  36.                 }
  37.             }
  38.             return false;
  39.         }
  40.     }
  41. }
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement