Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace liczbynaslowa {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- /// <summary>
- /// Summary for Form1
- /// </summary>
- public ref class Form1 : public System::Windows::Forms::Form
- {
- public:
- Form1(void)
- {
- InitializeComponent();
- //
- //TODO: Add the constructor code here
- //
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~Form1()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::Button^ button1;
- protected:
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::TextBox^ textBox1;
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void)
- {
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->textBox1 = (gcnew System::Windows::Forms::TextBox());
- this->SuspendLayout();
- //
- // button1
- //
- this->button1->Location = System::Drawing::Point(16, 66);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(75, 23);
- this->button1->TabIndex = 0;
- this->button1->Text = L"Zamień";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
- //
- // label1
- //
- this->label1->AutoSize = true;
- this->label1->Location = System::Drawing::Point(13, 13);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(38, 13);
- this->label1->TabIndex = 1;
- this->label1->Text = L"Liczba";
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Location = System::Drawing::Point(126, 13);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(78, 13);
- this->label2->TabIndex = 2;
- this->label2->Text = L"Liczba słownie";
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->Location = System::Drawing::Point(129, 30);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(0, 13);
- this->label3->TabIndex = 3;
- //
- // textBox1
- //
- this->textBox1->Location = System::Drawing::Point(16, 30);
- this->textBox1->MaxLength = 5;
- this->textBox1->Name = L"textBox1";
- this->textBox1->Size = System::Drawing::Size(51, 20);
- this->textBox1->TabIndex = 4;
- //
- // Form1
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(572, 98);
- this->Controls->Add(this->textBox1);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->button1);
- this->Name = L"Form1";
- this->Text = L"Form1";
- this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- int j=textBox1->Text->Length;
- bool bad=false;
- String^ liczba="";
- for (int i=0; i<j; i++)
- {
- if (!bad)
- {
- if (textBox1->Text[i]>=48 && textBox1->Text[i]<=57)
- {
- }
- else
- {
- bad=true;
- label3->Text="";
- MessageBox::Show("Podano nieprawidłową liczbę!","Aplikacja", MessageBoxButtons::OK,MessageBoxIcon::Asterisk);
- }
- }
- }
- if (!bad)
- {
- if (5-j==0)
- {
- if (textBox1->Text[0]=='1')
- {
- if (textBox1->Text[1]=='0')
- {
- liczba="Dziesięć";
- }
- if (textBox1->Text[1]=='1')
- {
- liczba="Jedenaście";
- }
- if (textBox1->Text[1]=='2')
- {
- liczba="Dwanaście";
- }
- if (textBox1->Text[1]=='3')
- {
- liczba="Trzynaście";
- }
- if (textBox1->Text[1]=='4')
- {
- liczba="Czternaścoe";
- }
- if (textBox1->Text[1]=='5')
- {
- liczba="Piętnaście";
- }
- if (textBox1->Text[1]=='6')
- {
- liczba="Szesnaście";
- }
- if (textBox1->Text[1]=='7')
- {
- liczba="Siedemnaście";
- }
- if (textBox1->Text[1]=='8')
- {
- liczba="Osiemnaście";
- }
- if (textBox1->Text[1]=='9')
- {
- liczba="Dziewiętnaście";
- }
- }
- if (textBox1->Text[0]=='2')
- {
- liczba="Dwadzieścia";
- }
- if (textBox1->Text[0]=='3')
- {
- liczba="Trzydzieści";
- }
- if (textBox1->Text[0]=='4')
- {
- liczba="Czterdzieści";
- }
- if (textBox1->Text[0]=='5')
- {
- liczba="Pięćdziesiąt";
- }
- if (textBox1->Text[0]=='6')
- {
- liczba="Sześćdziesiąt";
- }
- if (textBox1->Text[0]=='7')
- {
- liczba="Siedemdziesiąt";
- }
- if (textBox1->Text[0]=='8')
- {
- liczba="Osiemdziesiąt";
- }
- if (textBox1->Text[0]=='9')
- {
- liczba="Dziewięcdziesiąt";
- }
- if (textBox1->Text[0]!='1')
- {
- if (textBox1->Text[1]=='1')
- {
- liczba=liczba+"jeden";
- }
- if (textBox1->Text[1]=='2')
- {
- liczba=liczba+"dwa";
- }
- if (textBox1->Text[1]=='3')
- {
- liczba=liczba+"trzy";
- }
- if (textBox1->Text[1]=='4')
- {
- liczba=liczba+"cztery";
- }
- if (textBox1->Text[1]=='5')
- {
- liczba=liczba+"pięć";
- }
- if (textBox1->Text[1]=='6')
- {
- liczba=liczba+"sześć";
- }
- if (textBox1->Text[1]=='7')
- {
- liczba=liczba+"siedem";
- }
- if (textBox1->Text[1]=='8')
- {
- liczba=liczba+"osiem";
- }
- if (textBox1->Text[1]=='9')
- {
- liczba=liczba+"dziewięć";
- }
- }
- if (liczba->Length>0)
- liczba=liczba+" tysięcy ";
- if (textBox1->Text[2]=='1')
- {
- liczba=liczba+"sto";
- }
- if (textBox1->Text[2]=='2')
- {
- liczba=liczba+"dwieście";
- }
- if (textBox1->Text[2]=='3')
- {
- liczba=liczba+"trzysta";
- }
- if (textBox1->Text[2]=='4')
- {
- liczba=liczba+"czterysta";
- }
- if (textBox1->Text[2]=='5')
- {
- liczba=liczba+"pięćset";
- }
- if (textBox1->Text[2]=='6')
- {
- liczba=liczba+"sześćset";
- }
- if (textBox1->Text[2]=='7')
- {
- liczba=liczba+"siedemset";
- }
- if (textBox1->Text[2]=='8')
- {
- liczba=liczba+"osiemset";
- }
- if (textBox1->Text[2]=='9')
- {
- liczba=liczba+"dziewięćset";
- }
- if (textBox1->Text[3]=='1')
- {
- if (textBox1->Text[4]=='0')
- {
- liczba=liczba+"dziesięć";
- }
- if (textBox1->Text[4]=='1')
- {
- liczba=liczba+"jedenaście";
- }
- if (textBox1->Text[4]=='2')
- {
- liczba=liczba+"dwanaście";
- }
- if (textBox1->Text[4]=='3')
- {
- liczba=liczba+"trzynaście";
- }
- if (textBox1->Text[4]=='4')
- {
- liczba=liczba+"czternaścoe";
- }
- if (textBox1->Text[4]=='5')
- {
- liczba=liczba+"piętnaście";
- }
- if (textBox1->Text[4]=='6')
- {
- liczba=liczba+"szesnaście";
- }
- if (textBox1->Text[4]=='7')
- {
- liczba=liczba+"siedemnaście";
- }
- if (textBox1->Text[4]=='8')
- {
- liczba=liczba+"osiemnaście";
- }
- if (textBox1->Text[4]=='9')
- {
- liczba=liczba+"dziewiętnaście";
- }
- }
- if (textBox1->Text[3]=='2')
- {
- liczba=liczba+"dwadzieścia";
- }
- if (textBox1->Text[3]=='3')
- {
- liczba=liczba+"trzydzieści";
- }
- if (textBox1->Text[3]=='4')
- {
- liczba=liczba+"czterdzieści";
- }
- if (textBox1->Text[3]=='5')
- {
- liczba=liczba+"pięćdziesiąt";
- }
- if (textBox1->Text[3]=='6')
- {
- liczba=liczba+"sześćdziesiąt";
- }
- if (textBox1->Text[3]=='7')
- {
- liczba=liczba+"siedemdziesiąt";
- }
- if (textBox1->Text[3]=='8')
- {
- liczba=liczba+"osiemdziesiąt";
- }
- if (textBox1->Text[3]=='9')
- {
- liczba=liczba+"dziewięcdziesiąt";
- }
- if (textBox1->Text[3]!='1')
- {
- if (textBox1->Text[4]=='1')
- {
- liczba=liczba+"jeden";
- }
- if (textBox1->Text[4]=='2')
- {
- liczba=liczba+"dwa";
- }
- if (textBox1->Text[4]=='3')
- {
- liczba=liczba+"trzy";
- }
- if (textBox1->Text[4]=='4')
- {
- liczba=liczba+"cztery";
- }
- if (textBox1->Text[4]=='5')
- {
- liczba=liczba+"pięć";
- }
- if (textBox1->Text[4]=='6')
- {
- liczba=liczba+"sześć";
- }
- if (textBox1->Text[4]=='7')
- {
- liczba=liczba+"siedem";
- }
- if (textBox1->Text[4]=='8')
- {
- liczba=liczba+"osiem";
- }
- if (textBox1->Text[4]=='9')
- {
- liczba=liczba+"dziewięć";
- }
- }
- }
- label3->Text=liczba;
- }
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement