You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Klassenarbeit_LF6_AlexanderDegen_BSIT16_01_03_2017
|
|
|
|
|
{
|
|
|
|
|
class ArrayKlasse
|
|
|
|
|
{
|
|
|
|
|
private const int laenge = 100; //Anzahl der Plätze für das Array
|
|
|
|
|
private int[] feld;
|
|
|
|
|
|
|
|
|
|
//Konstruktor
|
|
|
|
|
public ArrayKlasse()
|
|
|
|
|
{
|
|
|
|
|
feld = new int[laenge];
|
|
|
|
|
Random zufall = new Random();
|
|
|
|
|
|
|
|
|
|
//feld mit Zufallszahlen im Wertebereich -999 ... 999 füllen
|
|
|
|
|
for(int i = 0; i < laenge; i++)
|
|
|
|
|
{
|
|
|
|
|
feld[i] = zufall.Next(-1000, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Parameterloser Aufruf
|
|
|
|
|
public void initZufall()
|
|
|
|
|
{
|
|
|
|
|
Random zufall = new Random();
|
|
|
|
|
for (int i = 0; i < laenge; i++)
|
|
|
|
|
{
|
|
|
|
|
feld[i] = zufall.Next(-1000, 1000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Aufruf mit Obergrenze
|
|
|
|
|
public void initZufall(int oberGrenze)
|
|
|
|
|
{
|
|
|
|
|
Random zufall = new Random();
|
|
|
|
|
for (int i = 0; i < laenge; i++)
|
|
|
|
|
{
|
|
|
|
|
feld[i] = zufall.Next(-1000, oberGrenze);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Aufruf mit Ober - und Untergrenze
|
|
|
|
|
public void initZufall(int oberGrenze, int unterGrenze)
|
|
|
|
|
{
|
|
|
|
|
Random zufall = new Random();
|
|
|
|
|
for (int i = 0; i < laenge; i++)
|
|
|
|
|
{
|
|
|
|
|
feld[i] = zufall.Next(unterGrenze, oberGrenze);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|