Advertisement
zolffik

btnTest2.xaml.cs

May 1st, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Navigation;
  8. using Microsoft.Phone.Controls;
  9. using Microsoft.Phone.Shell;
  10. using System.Diagnostics;
  11. using System.Threading;
  12.  
  13. namespace testy_wp
  14. {
  15.     public partial class Test2 : PhoneApplicationPage
  16.     {
  17.         public Test2()
  18.         {
  19.             int max = 1000;
  20.             String tekst = "";
  21.  
  22.             long[] series = new long[max];
  23.  
  24.             series[0] = 0;
  25.             series[1] = 1;
  26.  
  27.             Stopwatch stopwatch = new Stopwatch();
  28.             stopwatch.Start();
  29.             for (int i = 2; i < max; i++)
  30.             {
  31.                 series[i] = series[i - 1] + series[i - 2];
  32.             }
  33.             tekst = "Ciąg Fibannaciego dla " + max + " wyrazów" + "\n" + "\n";
  34.             for (int i = 0; i < max; i++)
  35.             {
  36.                 tekst += series[i] + "\n";
  37.             }
  38.             stopwatch.Stop();
  39.             WynikTest2.Text = ("Wykonanie zajęło  " + stopwatch.Elapsed.TotalMilliseconds.ToString() + "  sek." + "\n" + "\n" + tekst);
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement