Morogn93

Untitled

Feb 5th, 2018
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace TestFora
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Program p2 = new Program();
  10.             p2.Test();
  11.             Console.ReadLine();
  12.  
  13.         }
  14.  
  15.  
  16.  
  17.         public bool[] CheckWordRangeOfAscii(int rangeForm, int rangeTo, int[] valueOfArray)
  18.         {
  19.             bool[] temp = new bool[valueOfArray.Length];
  20.  
  21.             for (int i = 0; i < valueOfArray.Length; i++)
  22.             {
  23.                 if (valueOfArray[i] >= rangeForm || valueOfArray[i] <= rangeTo)
  24.                 {
  25.                     temp[i] = true;
  26.                 }
  27.  
  28.                 else if (valueOfArray[i] < rangeForm || valueOfArray[i] > rangeTo)
  29.                 {
  30.                     temp[i] = false;
  31.                 }
  32.             }
  33.             return temp;
  34.  
  35.         }
  36.  
  37.         public void Test()
  38.         {
  39.             int[] tablica = { 10,20,30,405,60};
  40.             bool[] wartosc =  CheckWordRangeOfAscii(23, 40, tablica);
  41.  
  42.             for(int i =0; i<wartosc.Length; i++ )
  43.             {
  44.                 Console.WriteLine(wartosc[i]);
  45.             }
  46.  
  47.         }
  48.  
  49.  
  50.  
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment