Advertisement
Blizzardo1

Unsafe Random Rise Run Program

Sep 28th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Console
  7. {
  8.     class Program
  9.     {
  10.         static unsafe void Main(string[] args)
  11.         {
  12.             double* x = stackalloc double[10];
  13.             double* y = stackalloc double[10];
  14.             double* m = stackalloc double[10];
  15.             double* b = stackalloc double[10];
  16.            
  17.             for (int i = 0; i < 10; i++)
  18.             {
  19.                 b[i] = Next();
  20.                 m[i] = Next();
  21.                 x[i] = Next();
  22.                 y[i] = (m[i] * x[i]) + b[i];
  23.                 Console.WriteLine("Rise (y) = {0}, Run (x) = {1}", y[i], x[i]);
  24.             }
  25.             Console.ReadKey(true);
  26.         }
  27.  
  28.         static unsafe int Next()
  29.         {
  30.             return (new Random()).Next(0, 32);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement