PDA

View Full Version : C#



KamIto0o
12-17-2013, 16:30
Здравейте ако може малко помощ имам задание http://alfa.kachi-snimka.info/images-2013/opt1387300766p.jpg
до сега съм измислила ето това
[CODE]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Kursova
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}

private void Form1_Load(object sender, EventArgs e)
{

int[] a = new int[10];
int[] b = new int[10];
String[] c = new String[10];
String[] v = new String[10];

for (int i = 0; i < b.Length; i++)
{ b[i] = i; }
for (int i = 0; i < a.Length; i++)
{ a[i] = i; }
int j=0;
for(int i=0;i<a.Length;i++)
{if (a[i]<0)
c[j] = "blue";
else
c[j]="red";
j++;
}
listBox1.Height = (j + 1) * listBox1.ItemHeight + 1;
listBox1.DataSource = c;
int l=0;
for(int i=0;i<a.Length;i++)
{for(int r=0;r<b.Length;r++)
{ if(a[i]==b[r])
{ v[l]="Yellow"; l++; }
if(a[i] != b[r])
{ v[l] = "D"; l++; }
}
}
listBox2.Height = (l + 1) * listBox2.ItemHeight + 1;
listBox2.DataSource = v;

}
}
}
но ми показва ето тази грешка http://alfa.kachi-snimka.info/images-2013/opt1387300897r.jpg
начинаеща съм и пробвах какво ли не но не мога да се справя .. :(