Используя шифр четырех квадратов, зашифровать слово programmer.
надо сделать на форме, там надо использовать компонент StringGrid
Я немного написал коду, но незнаю правильно или нет.... Очень прошу помогите=)
#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::Button2Click(TObject *Sender)
{
sg1->Cells[0][0]='k';
sg1->Cells[1][0]='i';
sg1->Cells[2][0]='n';
sg1->Cells[3][0]='g';
sg1->Cells[4][0]='d';
sg1->Cells[0][1]='o';
sg1->Cells[1][1]='m';
sg1->Cells[2][1]='a';
sg1->Cells[3][1]='b';
sg1->Cells[4][1]='c';
sg1->Cells[0][2]='e';
sg1->Cells[1][2]='f';
sg1->Cells[2][2]='h';
sg1->Cells[3][2]='e';
sg1->Cells[4][2]='p';
sg1->Cells[0][3]='g';
sg1->Cells[1][3]='r';
sg1->Cells[2][3]='s';
sg1->Cells[3][3]='t';
sg1->Cells[4][3]='u';
sg1->Cells[0][4]='v';
sg1->Cells[1][4]='w';
sg1->Cells[2][4]='x';
sg1->Cells[3][4]='y';
sg1->Cells[4][4]='z';
///////////////////////
sg2->Cells[0][0]='v';
sg2->Cells[1][0]='g';
sg2->Cells[2][0]='e';
sg2->Cells[3][0]='0';
sg2->Cells[4][0]='k';
sg2->Cells[0][1]='w';
sg2->Cells[1][1]='r';
sg2->Cells[2][1]='f';
sg2->Cells[3][1]='m';
sg2->Cells[4][1]='i';
sg2->Cells[0][2]='x';
sg2->Cells[1][2]='s';
sg2->Cells[2][2]='h';
sg2->Cells[3][2]='a';
sg2->Cells[4][2]='n';
sg2->Cells[0][3]='y';
sg2->Cells[1][3]='t';
sg2->Cells[2][3]='e';
sg2->Cells[3][3]='b';
sg2->Cells[4][3]='g';
sg2->Cells[0][4]='z';
sg2->Cells[1][4]='u';
sg2->Cells[2][4]='p';
sg2->Cells[3][4]='c';
sg2->Cells[4][4]='d';
///////////////////////
sg3->Cells[0][0]='z';
sg3->Cells[1][0]='y';
sg3->Cells[2][0]='x';
sg3->Cells[3][0]='w';
sg3->Cells[4][0]='v';
sg3->Cells[0][1]='u';
sg3->Cells[1][1]='t';
sg3->Cells[2][1]='s';
sg3->Cells[3][1]='r';
sg3->Cells[4][1]='g';
sg3->Cells[0][2]='p';
sg3->Cells[1][2]='e';
sg3->Cells[2][2]='h';
sg3->Cells[3][2]='f';
sg3->Cells[4][2]='e';
sg3->Cells[0][3]='c';
sg3->Cells[1][3]='b';
sg3->Cells[2][3]='a';
sg3->Cells[3][3]='m';
sg3->Cells[4][3]='o';
sg3->Cells[0][4]='d';
sg3->Cells[1][4]='g';
sg3->Cells[2][4]='n';
sg3->Cells[3][4]='i';
sg3->Cells[4][4]='k';
///////////////////////
sg4->Cells[0][0]='d';
sg4->Cells[1][0]='c';
sg4->Cells[2][0]='p';
sg4->Cells[3][0]='u';
sg4->Cells[4][0]='z';
sg4->Cells[0][1]='g';
sg4->Cells[1][1]='b';
sg4->Cells[2][1]='e';
sg4->Cells[3][1]='t';
sg4->Cells[4][1]='y';
sg4->Cells[0][2]='n';
sg4->Cells[1][2]='a';
sg4->Cells[2][2]='h';
sg4->Cells[3][2]='s';
sg4->Cells[4][2]='x';
sg4->Cells[0][3]='i';
sg4->Cells[1][3]='m';
sg4->Cells[2][3]='f';
sg4->Cells[3][3]='r';
sg4->Cells[4][3]='w';
sg4->Cells[0][4]='k';
sg4->Cells[1][4]='o';
sg4->Cells[2][4]='e';
sg4->Cells[3][4]='g';
sg4->Cells[4][4]='v';
AnsiString s;
s=Edit1->Text ;
}
надо сделать на форме, там надо использовать компонент StringGrid
Я немного написал коду, но незнаю правильно или нет.... Очень прошу помогите=)
#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::Button2Click(TObject *Sender)
{
sg1->Cells[0][0]='k';
sg1->Cells[1][0]='i';
sg1->Cells[2][0]='n';
sg1->Cells[3][0]='g';
sg1->Cells[4][0]='d';
sg1->Cells[0][1]='o';
sg1->Cells[1][1]='m';
sg1->Cells[2][1]='a';
sg1->Cells[3][1]='b';
sg1->Cells[4][1]='c';
sg1->Cells[0][2]='e';
sg1->Cells[1][2]='f';
sg1->Cells[2][2]='h';
sg1->Cells[3][2]='e';
sg1->Cells[4][2]='p';
sg1->Cells[0][3]='g';
sg1->Cells[1][3]='r';
sg1->Cells[2][3]='s';
sg1->Cells[3][3]='t';
sg1->Cells[4][3]='u';
sg1->Cells[0][4]='v';
sg1->Cells[1][4]='w';
sg1->Cells[2][4]='x';
sg1->Cells[3][4]='y';
sg1->Cells[4][4]='z';
///////////////////////
sg2->Cells[0][0]='v';
sg2->Cells[1][0]='g';
sg2->Cells[2][0]='e';
sg2->Cells[3][0]='0';
sg2->Cells[4][0]='k';
sg2->Cells[0][1]='w';
sg2->Cells[1][1]='r';
sg2->Cells[2][1]='f';
sg2->Cells[3][1]='m';
sg2->Cells[4][1]='i';
sg2->Cells[0][2]='x';
sg2->Cells[1][2]='s';
sg2->Cells[2][2]='h';
sg2->Cells[3][2]='a';
sg2->Cells[4][2]='n';
sg2->Cells[0][3]='y';
sg2->Cells[1][3]='t';
sg2->Cells[2][3]='e';
sg2->Cells[3][3]='b';
sg2->Cells[4][3]='g';
sg2->Cells[0][4]='z';
sg2->Cells[1][4]='u';
sg2->Cells[2][4]='p';
sg2->Cells[3][4]='c';
sg2->Cells[4][4]='d';
///////////////////////
sg3->Cells[0][0]='z';
sg3->Cells[1][0]='y';
sg3->Cells[2][0]='x';
sg3->Cells[3][0]='w';
sg3->Cells[4][0]='v';
sg3->Cells[0][1]='u';
sg3->Cells[1][1]='t';
sg3->Cells[2][1]='s';
sg3->Cells[3][1]='r';
sg3->Cells[4][1]='g';
sg3->Cells[0][2]='p';
sg3->Cells[1][2]='e';
sg3->Cells[2][2]='h';
sg3->Cells[3][2]='f';
sg3->Cells[4][2]='e';
sg3->Cells[0][3]='c';
sg3->Cells[1][3]='b';
sg3->Cells[2][3]='a';
sg3->Cells[3][3]='m';
sg3->Cells[4][3]='o';
sg3->Cells[0][4]='d';
sg3->Cells[1][4]='g';
sg3->Cells[2][4]='n';
sg3->Cells[3][4]='i';
sg3->Cells[4][4]='k';
///////////////////////
sg4->Cells[0][0]='d';
sg4->Cells[1][0]='c';
sg4->Cells[2][0]='p';
sg4->Cells[3][0]='u';
sg4->Cells[4][0]='z';
sg4->Cells[0][1]='g';
sg4->Cells[1][1]='b';
sg4->Cells[2][1]='e';
sg4->Cells[3][1]='t';
sg4->Cells[4][1]='y';
sg4->Cells[0][2]='n';
sg4->Cells[1][2]='a';
sg4->Cells[2][2]='h';
sg4->Cells[3][2]='s';
sg4->Cells[4][2]='x';
sg4->Cells[0][3]='i';
sg4->Cells[1][3]='m';
sg4->Cells[2][3]='f';
sg4->Cells[3][3]='r';
sg4->Cells[4][3]='w';
sg4->Cells[0][4]='k';
sg4->Cells[1][4]='o';
sg4->Cells[2][4]='e';
sg4->Cells[3][4]='g';
sg4->Cells[4][4]='v';
AnsiString s;
s=Edit1->Text ;
}