Void ZakladFormula1::dodajNowyZaklad(){
	System::String^ tekst;
	Int16 id;
	StreamWriter^ plik = gcnew StreamWriter("BazaDanych\\druzyny.txt", true, System::Text::Encoding::Default);
	StreamReader^ plikId = gcnew StreamReader("BazaDanych\\zakladID.txt", System::Text::Encoding::Default);

	tekst = plikId->ReadToEnd()->Trim();
	id = (Int16::Parse(tekst));
	id++;

	zakladId = id;
	plikId->Close();

	StreamWriter^ plik2 = gcnew StreamWriter("BazaDanych\\zakladID.txt", false, System::Text::Encoding::Default);
	plik2->Write(id.ToString());
	plik2->Close();

	plik->WriteLine("ID=" + this->zakladId);
	plik->WriteLine(this->obiektZakladu1->getTyp());
	plik->WriteLine(this->obiektZakladu1->getNazwa1());
	plik->WriteLine(this->obiektZakladu1->getKurs1());
	plik->WriteLine(this->obiektZakladu2->getNazwa1());
	plik->WriteLine(this->obiektZakladu2->getKurs1());
	plik->WriteLine(this->obiektZakladu3->getNazwa1());
	plik->WriteLine(this->obiektZakladu3->getKurs1());
	plik->WriteLine("###########");

	plik->Close();
}
Exemplo n.º 2
0
Void MainForm::Sum()
{
	btnTask1->Enabled = false;
	btnTask2->Enabled = false;
	btnTask3->Enabled = false;
	FileStream ^output = gcnew FileStream("sum.txt", FileMode::Create);
	StreamWriter ^writer = gcnew StreamWriter(output);
	String ^str = "";
	int l = 0, m = (primes[primes->Length - 1] / 2 - 1) / 100 + 1;
	pbRun->Value = 0;
	double start = 0.0, time = 0.0;
	start = clock();
	for (int i = 4; i < primes[primes->Length - 1] + 1; i += 2) {
		for (int j = 0; j < count; j++) {
			if (a[i - primes[j]]) {
				str = i.ToString() + " = " + primes[j].ToString() + " + " + (i - primes[j]).ToString();
				writer->WriteLine(str);
				if (l % m == 0) {
					pbRun->Value++;
				}
				l++;
				break;
			}
		}
	}
	time = clock() - start;
	MessageBox::Show("¬рем¤ выполнени¤: " + time.ToString() + " мс");
	pbRun->Value = 0;
	writer->Close();
	output->Close();
	pbRun->Value = 0;
	btnTask1->Enabled = true;
	btnTask2->Enabled = true;
	btnTask3->Enabled = true;
}
Exemplo n.º 3
0
FileEntitySchemeOutputStream::FileEntitySchemeOutputStream(ptr<Action> action, ptr<Entity> entity, size_t blockSize)
: action(action), entity(entity), blockSize(blockSize), totalSize(0), currentBlockIndex(0), currentBlockSize(0)
{
	descriptorHashStream = NEW(MemoryStream());
	descriptorHashWriter = NEW(StreamWriter(descriptorHashStream));

	hashStream = NEW(Crypto::WhirlpoolStream());
	totalHashStream = NEW(Crypto::WhirlpoolStream());
}
Exemplo n.º 4
0
Void MainForm::Primes()
{
	btnTask1->Enabled = false;
	btnTask2->Enabled = false;
	btnTask3->Enabled = false;
	pbRun->Value = 0;
	for (int i = 0; i < n; i++) {
		a[i] = true;
	}
	a[0] = a[1] = false;
	int k = 0, m = count / 100 + 1;
	double start = 0.0, time = 0.0;
	start = clock();
	for (int i = 2; k < count; ++i) {
		if (a[i]) {
			k++;
			if (k % m == 0) {
				pbRun->Value++;
			}
			if (i * 1ll * i < n) {
				for (int j = i * i; j < n; j += i) {
					a[j] = false;
				}
			}
		}
	}
	time = clock() - start;
	MessageBox::Show("¬рем¤ выполнени¤: " + time.ToString() + " мс");
	pbRun->Value = 0;
	k = 0;
	FileStream ^output = gcnew FileStream("primes.txt", FileMode::Create);
	StreamWriter ^writer = gcnew StreamWriter(output);
	String ^str = "";
	for (int i = 0; k < count; i++) {
		if (a[i]) {
			primes[k] = i;
			str = (k + 1).ToString() + " : " + i.ToString();
			writer->WriteLine(str);
			k++;
			if (k % m == 0) {
				pbRun->Value++;
			}
		}
	}
	writer->Close();
	output->Close();
	pbRun->Value = 0;
	btnTask1->Enabled = true;
	btnTask2->Enabled = true;
	btnTask3->Enabled = true;
}