Партнерка на США и Канаду по недвижимости, выплаты в крипто

  • 30% recurring commission
  • Выплаты в USDT
  • Вывод каждую неделю
  • Комиссия до 5 лет за каждого referral

void __fastcall Button3Click(TObject *Sender);

void __fastcall Button14Click(TObject *Sender);

void __fastcall Button8Click(TObject *Sender);

void __fastcall Button10Click(TObject *Sender);

void __fastcall Button13Click(TObject *Sender);

void __fastcall Button15Click(TObject *Sender);

void __fastcall N4Click(TObject *Sender);

void __fastcall N3Click(TObject *Sender);

void __fastcall Button6Click(TObject *Sender);

private: // User declarations

public: // User declarations

__fastcall TForm1(TComponent* Owner);

};

//

extern PACKAGE TForm1 *Form1;

//

#endif

Файл Unit1.cpp

//

#include <vcl. h>

#pragma hdrstop

#include "cod. h"

#include "cod. cpp"

#include "Unit1.h"

#include <fstream. h>

#include <stdio. h>

#include "Unit2.h"

//

#pragma package(smart_init)

#pragma link "CSPIN"

#pragma resource "*.dfm"

TForm1 *Form1;

//

coder* Kod;

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

Label11->Hide();

CSpinEdit2->Hide();

Button11->Hide();

Button12->Hide();

Button7->Hide();

Button2->Hide();

Button5->Hide();

Button3->Hide();

// N6->Enabled=0;

N20->Enabled=0;

N21->Enabled=0;

Kod=new coder[1];

Kod->Init();

StringGrid1->Enabled=0;

StringGrid2->Enabled=0;

StringGrid5->Enabled=0;

}

//

void __fastcall TForm1::Button1Click(TObject *Sender)

{

if(Button1->Caption=="Вручную")

{

Label10->Show();

НЕ нашли? Не то? Что вы ищете?

Button4->Caption="Сохранить";

CSpinEdit1->Show();

StringGrid1->ColCount=CSpinEdit1->Value+1;

int R=CSpinEdit1->Value;

Kod->setR(R);

bool *pol=new bool[R+1];

pol[0]=1;

int i;

for(i=1; i<=R; i++)

pol[i]=0;

Kod->setPol(pol);

for(i=0; i<=R; i++)

StringGrid1->Cells[i][0]=IntToStr(Kod->getPol()[i]);

Button1->Caption="Отмена";

Button2->Show();

Button5->Show();

int max=1;

for(i=0;i<R;i++)

max*=2;

max=max-1-R;

if (max>32768) max=32768;

if (max<1) max=1;

CSpinEdit2->MaxValue=max;

StringGrid1->Enabled=1;

CSpinEdit2->Show();

Label11->Show();

N7->Enabled=0;

}

else

{

CSpinEdit2->Hide();

Label11->Hide();

Button1->Caption="Вручную";

Button4->Caption="Загрузить";

StringGrid1->ColCount=20;

for(int i=0; i<20; i++)

StringGrid1->Cells[i][0]="";

StringGrid1->Enabled=0;

N7->Enabled=1;

}

}

//

void __fastcall TForm1::Button2Click(TObject *Sender)

{

if(Button2->Caption=="Вручную")

{

Button5->Caption="Сохранить";

StringGrid2->ColCount=CSpinEdit2->Value;

int N=CSpinEdit2->Value;

Kod->setN(Kod->getR()+N);

bool *inf=new bool[Kod->getN()];

int i;

for(i=0; i<N; i++)

inf[i]=0;

Kod->setInf(inf);

for(i=0; i<N; i++)

StringGrid2->Cells[i][0]=IntToStr(Kod->getInf()[i]);

Button2->Caption="Отмена";

StringGrid2->Enabled=1;

Button11->Show();

N20->Enabled=1;

}

else

{

Button2->Caption="Вручную";

Button5->Caption="Загрузить";

StringGrid2->ColCount=20;

for(int i=0; i<20; i++)

StringGrid2->Cells[i][0]="";

StringGrid2->Enabled=0;

Button11->Hide();

N20->Enabled=0;

}

}

//

int Col=0;

void __fastcall TForm1::StringGrid1DblClick(TObject *Sender)

{

if(Col!=0)

{

Kod->getPol()[Col]=StrToInt(StringGrid1->Cells[Col][0])^1;

StringGrid1->Cells[Col][0]=IntToStr(Kod->getPol()[Col]);

}

}

//

void __fastcall TForm1::StringGrid1SelectCell(TObject *Sender, int ACol,

int ARow, bool &CanSelect)

{

Col=ACol;

}

//

void __fastcall TForm1::StringGrid2DblClick(TObject *Sender)

{

Kod->getInf()[Col]=StrToInt(StringGrid2->Cells[Col][0])^1;

StringGrid2->Cells[Col][0]=IntToStr(Kod->getInf()[Col]);

}

//

void __fastcall TForm1::StringGrid2SelectCell(TObject *Sender, int ACol,

int ARow, bool &CanSelect)

{

Col=ACol;

}

//

void __fastcall TForm1::Button11Click(TObject *Sender)

{

Kod->Coder();

StringGrid3->ColCount=Kod->getR();

StringGrid4->ColCount=Kod->getN();

StringGrid5->ColCount=Kod->getN();

int i;

for(i=0; i<Kod->getR(); i++)

StringGrid3->Cells[i][0]=IntToStr(Kod->getCod()[i+1]);

bool *err=new bool[Kod->getN()];

for(i=0; i<Kod->getN(); i++)

{

err[i]=0;

StringGrid4->Cells[i][0]=IntToStr(Kod->getInf()[i]);

StringGrid5->Cells[i][0]=IntToStr(err[i]);

}

Kod->setErr(err);

StringGrid5->Enabled=1;

Button7->Show();

Button12->Show();

Button3->Show();

N21->Enabled=1;

}

//

void __fastcall TForm1::StringGrid5DblClick(TObject *Sender)

{

Kod->getErr()[Col]=StrToInt(StringGrid5->Cells[Col][0])^1;

StringGrid5->Cells[Col][0]=IntToStr(Kod->getErr()[Col]);

}

//

void __fastcall TForm1::StringGrid5SelectCell(TObject *Sender, int ACol,

int ARow, bool &CanSelect)

{

Col=ACol;

}

//

void __fastcall TForm1::Button12Click(TObject *Sender)

{

Kod->Decod();

StringGrid6->ColCount=Kod->getR();

StringGrid7->ColCount=Kod->getN()-Kod->getR();

for(int i=0; i<Kod->getN(); i++)

{

StringGrid5->Cells[i][0]=IntToStr(Kod->getErr()[i]);

}

int err=0, k=0, i;

for(i=0; i<Kod->getR(); i++)

{

if(Kod->getOst()[i+1]==1)

k=1;

StringGrid6->Cells[i][0]=IntToStr(Kod->getOst()[i+1]);

}

for(i=0; i<Kod->getN()-Kod->getR(); i++)

{

if(Kod->getDec()[i]!=Kod->getInf()[i])

err++;

StringGrid7->Cells[i][0]=IntToStr(Kod->getDec()[i]);

}

if(k==0)

Memo1->Lines->Add("Передано без ошибок");

else

{

Memo1->Lines->Add("Ошибки при передаче");

if(err==0)

Memo1->Lines->Add("Ошибки исправлены");

else Memo1->Lines->Add("Передано с "+IntToStr(err)+" ошибками");

}

Button14->Show();

}

//

void __fastcall TForm1::Button4Click(TObject *Sender)

{

if(Button4->Caption=="Загрузить")

{

bool* pol;

OpenDialog1->Filter="*.pol|*.pol";

if(OpenDialog1->Execute())

{

AnsiString filename=OpenDialog1->FileName;

FILE *P=fopen(filename. c_str(),"rb");

fseek(P,0l,0);

char A=128;

int i=0;

char a[5]={0};

do

{

a[i]=fgetc(P);

i++;

} while(feof(P)==0&&i<4);

Kod->setR(a[0]);

pol=new bool[Kod->getR()+1];

int q=0;

for(i=0;i<4;i++)

{

A=128;

for(int j=0;j<8;j++)

{

if((8*i+j)<=Kod->getR())

{pol[8*i+j]=((a[i+1]&A)>>(7-j))&0x1;

A=A/2;

q++; }

}

}

fclose(P);

StringGrid1->ColCount=Kod->getR()+1;

for(int i=0; i<=Kod->getR(); i++)

StringGrid1->Cells[i][0]=IntToStr(pol[i]);

Kod->setPol(pol);

Button2->Show();

Button5->Show();

int max=1, R=Kod->getR();

for(int i=0;i<R;i++)

max*=2;

max=max-1-R;

if (max>32768) max=32768;

if (max<1) max=1;

CSpinEdit2->MaxValue=max;

StringGrid1->Enabled=1;

CSpinEdit2->Show();

Label11->Show();

Button4->Caption="Сохранить";

N7->Enabled=0;

N14->Enabled=1;

Memo1->Lines->Add("Загружен файл "+filename);

CSpinEdit1->Value=Kod->getR();

}

}

else

{

SaveDialog1->Filter="*.pol|*.pol";

if(SaveDialog1->Execute())

{

AnsiString filename=SaveDialog1->FileName+".pol";

AnsiString s="";

FILE *P=fopen(filename. c_str(),"w+b");

fseek(P,0l,0);

if(Kod->getPol()!=0)

{

char L=0;

int A=128;

L=L|(Kod->getR());

fputc(L, P);

for(int i=0;i<=Kod->getR()/8;i++)

{

L=0;

A=0x80;

for(int j=0;j<8;j++)

{

if(8*i+j<=Kod->getR()) L=L|((Kod->getPol()[i*8+j])*A);

A=A/2;

}

fputc(L, P);

}

}

fclose(P);

Memo1->Lines->Add("Полином сохранен "+filename);

}

}

}

//

void __fastcall TForm1::Button5Click(TObject *Sender)

{

if(Button5->Caption=="Загрузить")

{

bool* inf;

int K;

OpenDialog1->Filter="*.inf|*.inf";

if(OpenDialog1->Execute())

{

AnsiString filename=OpenDialog1->FileName;

FILE *P=fopen(filename. c_str(),"rb");

fseek(P,0l,0);

char A=128;

int i=0;

fread(&K, sizeof(K), 1, P);

if(K>CSpinEdit2->MaxValue)

K=CSpinEdit2->MaxValue;

Kod->setN(K+Kod->getR());

inf=new bool[Kod->getN()];

char m, c;

for(i=0;i<=K/8;i++)

{

A=128;

c=fgetc(P);

for(int j=0;j<8;j++)

{

if((8*i+j)<K)

{

m=0;

m=m|1<<7-j;

m=c&m;

m=m>>7-j;

if(m)

inf[8*i+j]=true;

else

inf[8*i+j]=false;

}

}

}

fclose(P);

StringGrid2->ColCount=K;

for(int i=0; i<K; i++)

StringGrid2->Cells[i][0]=IntToStr(inf[i]);

Kod->setInf(inf);

Button2->Caption="Отмена";

StringGrid2->Enabled=1;

Button11->Show();

Button5->Caption="Сохранить";

N20->Enabled=1;

Memo1->Lines->Add("Загружен файл "+filename);

CSpinEdit2->Value=Kod->getN()-Kod->getR();

}

}

else

{

SaveDialog1->Filter="*.inf|*.inf";

if(SaveDialog1->Execute())

{

AnsiString filename=SaveDialog1->FileName+".inf";

AnsiString s="";

FILE *P=fopen(filename. c_str(),"w+b");

fseek(P,0l,0);

bool*inf=Kod->getInf();

if(Kod->getInf()!=0)

{

char L=0;

int A=128;

int K=(Kod->getN()-Kod->getR());

fwrite(&K, sizeof(K), 1, P);

for(int i=0;i<=K/8;i++)

{

L=0;

for(int j=0;j<8;j++)

{

if(8*i+j<K)

if(inf[8*i+j])

L=L|1<<7-j;

}

fputc(L, P);

}

}

fclose(P);

Memo1->Lines->Add("Информация сохранена "+filename);

}

}

}

//

void __fastcall TForm1::Button7Click(TObject *Sender)

{

bool* err;

int K;

OpenDialog1->Filter="*.err|*.err";

if(OpenDialog1->Execute())

{

AnsiString filename=OpenDialog1->FileName;

FILE *P=fopen(filename. c_str(),"rb");

fread(&K, sizeof(K), 1, P);

if(K>Kod->getN())

K=Kod->getN();

char c, m;

int i=0;

/*char *a=new char;

do

{

a[i]=fgetc(P);

i++;

} while(feof(P)==0&&i<=b/8); */

err=new bool[Kod->getN()];

for(i=0;i<=K/8;i++)

{

c=fgetc(P);

for(int j=0;j<8;j++)

{

if((8*i+j)<K)

{

// err[8*i+j]=((a[i]&A)>>(7-j))&0x1;

// A=A/2;

m=0;

m=m|1<<7-j;

m=c&m;

m=m>>7-j;

if(m)

err[8*i+j]=true;

else

err[8*i+j]=false;

}

}

}

fclose(P);

if(K<Kod->getN())

for(int i=K; i<Kod->getN(); i++)

err[i]=0;

for(int i=0; i<Kod->getN(); i++)

StringGrid5->Cells[i][0]=IntToStr(err[i]);

Kod->setErr(err);

}

}

//

void __fastcall TForm1::Button3Click(TObject *Sender)

{

SaveDialog1->Filter="*.err|*.err";

if(SaveDialog1->Execute())

{

AnsiString filename=SaveDialog1->FileName+".err";

AnsiString s="";

FILE *P=fopen(filename. c_str(),"w+b");

fseek(P,0l,0);

bool*err=Kod->getErr();

if(Kod->getErr()!=0)

{

char L=0;

int A=128;

int K=Kod->getN();

fwrite(&K, sizeof(K), 1, P);

//L=L|K;

//fputc(L, P);

for(int i=0;i<=K/8;i++)

{

L=0;

A=0x80;

for(int j=0;j<8;j++)

{

if(8*i+j<K)

if(err[i*8+j])

L=L|1<<7-j;

}

fputc(L, P);

}

}

fclose(P);

Memo1->Lines->Add("Ошибки сохранены "+filename);

}

}

//

void __fastcall TForm1::Button14Click(TObject *Sender)

{

Label11->Hide();

CSpinEdit2->Hide();

Button11->Hide();

Button12->Hide();

Button7->Hide();

Button2->Hide();

Button5->Hide();

Button3->Hide();

Button1->Caption="Вручную";

Button2->Caption="Вручную";

Button4->Caption="Загрузить";

Button5->Caption="Загрузить";

Button6->Caption="Рандом";

// N6->Enabled=0;

N20->Enabled=0;

N21->Enabled=0;

StringGrid1->Enabled=0;

StringGrid2->Enabled=0;

StringGrid5->Enabled=0;

StringGrid1->ColCount=20;

StringGrid2->ColCount=20;

StringGrid3->ColCount=20;

StringGrid4->ColCount=20;

StringGrid5->ColCount=20;

StringGrid6->ColCount=20;

StringGrid7->ColCount=20;

for(int i=0; i<20; i++)

{

StringGrid1->Cells[i][0]="";

StringGrid2->Cells[i][0]="";

StringGrid3->Cells[i][0]="";

StringGrid4->Cells[i][0]="";

StringGrid5->Cells[i][0]="";

StringGrid6->Cells[i][0]="";

StringGrid7->Cells[i][0]="";

}

CSpinEdit2->MaxValue=32768;

}

//

void __fastcall TForm1::Button8Click(TObject *Sender)

{

SaveDialog1->Filter="*.cod|*.cod";

if(SaveDialog1->Execute())

{

AnsiString filename=SaveDialog1->FileName+".cod";

AnsiString s="";

FILE *P=fopen(filename. c_str(),"w+b");

fseek(P,0l,0);

if(Kod->getInf()!=0)

{

char L=0;

int A=128;

int K=Kod->getN();

fwrite(&K, sizeof(K), 1, P);

for(int i=0;i<=K/8;i++)

{

L=0;

A=0x80;

for(int j=0;j<8;j++)

{

if(8*i+j<K)

if(Kod->getInf()[8*i+j])

L=L|1<<7-j;

}

fputc(L, P);

}

}

fclose(P);

Memo1->Lines->Add("Кодированное сообщение сохранено "+filename);

}

}

//

void __fastcall TForm1::Button10Click(TObject *Sender)

{

bool* cod;

OpenDialog1->Filter="*.cod|*.cod";

if(OpenDialog1->Execute())

{

AnsiString filename=OpenDialog1->FileName;

FILE *P=fopen(filename. c_str(),"rb");

fseek(P,0l,0);

int K;

fread(&K, sizeof(K), 1, P);

char A=128;

int i=0;

char c, m;

//char b=fgetc(P);

/*char *a=new char;

do

{

a[i]=fgetc(P);

i++;

} while(feof(P)==0&&i<=b/8); */

cod=new bool[K];

for(i=0;i<=K/8;i++)

{

c=fgetc(P);

for(int j=0;j<8;j++)

{

if((8*i+j)<K)

{

/*cod[8*i+j]=((a[i]&A)>>(7-j))&0x1;

A=A/2;*/

m=0;

m=m|1<<7-j;

m=c&m;

m=m>>7-j;

if(m)

cod[8*i+j]=true;

else

cod[8*i+j]=false;

}

}

}

fclose(P);

StringGrid4->ColCount=K;

for(int i=0; i<K; i++)

StringGrid4->Cells[i][0]=IntToStr(cod[i]);

Kod->setInf(cod);

Memo1->Lines->Add("Загружен файл "+filename);

}

}

//

void __fastcall TForm1::Button13Click(TObject *Sender)

{

SaveDialog1->Filter="*.dec|*.dec";

if(SaveDialog1->Execute())

{

AnsiString filename=SaveDialog1->FileName+".dec";

AnsiString s="";

FILE *P=fopen(filename. c_str(),"w+b");

int K;

fseek(P,0l,0);

if(Kod->getDec()!=0)

{

char L=0;

int K=Kod->getN()-Kod->getR();

fwrite(&K, sizeof(K), 1, P);

for(int i=0;i<=K/8;i++)

{

L=0;

for(int j=0;j<8;j++)

{

if(8*i+j<K)

if(Kod->getDec()[i*8+j])

L=L|1<<7-j;

}

fputc(L, P);

}

}

fclose(P);

Memo1->Lines->Add("Декодированное сообщение сохранено "+filename);

}

}

//

void __fastcall TForm1::Button15Click(TObject *Sender)

{

bool* dec;

int K;

OpenDialog1->Filter="*.dec|*.dec";

if(OpenDialog1->Execute())

{

AnsiString filename=OpenDialog1->FileName;

FILE *P=fopen(filename. c_str(),"rb");

fread(&K, sizeof(K), 1, P);

char c, m;

int i=0;

dec=new bool[K];

for(i=0;i<=K/8;i++)

{

c=fgetc(P);

for(int j=0;j<8;j++)

{

if((8*i+j)<K)

{

m=0;

m=m|1<<7-j;

m=c&m;

m=m>>7-j;

if(m)

dec[8*i+j]=true;

else

dec[8*i+j]=false;

}

}

}

fclose(P);

StringGrid7->ColCount=K;

for(int i=0; i<K; i++)

StringGrid7->Cells[i][0]=IntToStr(dec[i]);

Kod->setDec(dec);

Memo1->Lines->Add("Загружен файл "+filename);

}

}

//

void __fastcall TForm1::N4Click(TObject *Sender)

{

Form1->Close();

}

//

void __fastcall TForm1::N3Click(TObject *Sender)

{

Form2->Show();

}

//

void __fastcall TForm1::Button6Click(TObject *Sender)

{

randomize();

if(Button6->Caption=="Рандом")

{

CSpinEdit2->Show();

Button6->Caption="OK";

Label11->Show();

Button1->Hide();

Button2->Hide();

Button4->Hide();

}

else

{

int i;

bool *a, *b;

Kod->setR(CSpinEdit1->Value);

int max=1;

for(i=0;i<Kod->getR();i++)

max*=2;

max=max-1-Kod->getR();

StringGrid1->Enabled=1;

StringGrid2->Enabled=1;

if (max>32768) max=32768;

if (max<1) max=1;

CSpinEdit2->MaxValue=max;

Kod->setN(CSpinEdit2->Value+Kod->getR());

a=new bool[Kod->getR()];

b=new bool[Kod->getN()];

StringGrid1->ColCount=Kod->getR();

StringGrid2->ColCount=Kod->getN()-Kod->getR();

a[0]=1;

StringGrid1->Cells[0][0]=IntToStr(a[0]);

for(i=1; i<Kod->getR(); i++)

{

a[i]=rand()%2;

StringGrid1->Cells[i][0]=IntToStr(a[i]);

}

for(i=0; i<Kod->getN()-Kod->getR(); i++)

{

b[i]=rand()%2;

StringGrid2->Cells[i][0]=IntToStr(b[i]);

}

Kod->setPol(a);

Kod->setInf(b);

Button11->Show();

Button4->Show();

Button5->Show();

Button5->Caption="Сохранить";

Button4->Caption="Сохранить";

Button2->Caption="Отмена";

}

}

//

Приложение B
(справочное)

Библиографический список

1. Тутевич . – М.:Высшая школа, 1985. – 423 с.

2., , Бондарев и проектирование технических средств обмена и передачи информации. – М.:Высш. шк., 1990. – 224 с.

3.Супрун коды. М., Связь, 1с.

4.Методические указания по выполнению курсового проекта. Проектирование системы передачи данных. – Киров 2007.

5.СТП ВятГУ 101 – 2004. Общие требования к оформлению текстовых документов. – Киров, 2004. – 29 с.

6.СТП ВятГУ 102 – 2004. Общие требования к структуре, оформлению и представлению курсовых проектов и работ. – Киров, 2004. – 26 с.

7.Бармин лекций 2011 г.

Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4