Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
13
Добавлен:
28.06.2014
Размер:
2.57 Кб
Скачать
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button1Click(TObject *Sender)
{
        static const int n = 4;


        unsigned count = StringGrid1->RowCount;

        typedef Vector1<n>  Vector;
        NSD::List<Vector> lst;
        for(int i = 0; i < count; ++i)
        {

                lst.getLast().insertAfter(Vector(StringGrid1->Cells[0][i].c_str()));
        }
        Run(lst);
        unsigned resultCount = 0;
        for(NSD::List<Vector>::iterator h = lst.getFirst(); h; ++h, ++resultCount);
        StringGrid2->RowCount = resultCount;

        int i = 0;
        for(NSD::List<Vector>::iterator s = lst.getFirst(); s; ++s, ++i)
        {
                Vector curr = *s;
                AnsiString result;
                for(unsigned j = 0; j < n; ++j)
		{
			switch(curr.data_[j])
			{
			case _null: result += "0"; break;
			case _one: result += "1"; break;
			case _X: result += "x"; break;
			}
		}
                StringGrid2->Cells[0][i] = result;
        }

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Edit1Change(TObject *Sender)
{
        StringGrid1->RowCount = StrToInt(Edit1->Text);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
        StringGrid1->Cells[0][0] = "10xx01001xxxx101";
        StringGrid1->Cells[0][1] = "0x11x1xx1x00xx01";
        StringGrid1->Cells[0][2] = "xxxxxxxxxxxxx01x";

    /*    StringGrid1->Cells[0][0] = "001";
        StringGrid1->Cells[0][1] = "010";
        StringGrid1->Cells[0][2] = "011";
        StringGrid1->Cells[0][3] = "100";
        StringGrid1->Cells[0][4] = "101";
        StringGrid1->Cells[0][5] = "110";
      */
        //lst.getLast().insertAfter(Vector("10xx01001xxxx101"));
	//lst.getLast().insertAfter(Vector("0x11x1xx1x00xx01"));
	//lst.getLast().insertAfter(Vector("xxxxxxxxxxxxx01x"));
}
//---------------------------------------------------------------------------
Соседние файлы в папке DMath_lab1
  • #
    28.06.20143.68 Кб14Project1.bpr
  • #
    28.06.20141.07 Кб13Project1.cpp
  • #
    28.06.201417.75 Кб13Project1.obj
  • #
    28.06.2014876 б13Project1.res
  • #
    28.06.20142.16 Mб13Project1.tds
  • #
    28.06.20142.57 Кб13Unit1.cpp
  • #
    28.06.201451 б13Unit1.ddp
  • #
    28.06.20141.8 Кб14Unit1.dfm
  • #
    28.06.20141.2 Кб13Unit1.h
  • #
    28.06.2014144.71 Кб13Unit1.obj
  • #
    28.06.20142.57 Кб13Unit1.~cpp