Advertisement
Kajoj

piętnaście stopiętnaście

Apr 24th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.19 KB | None | 0 0
  1. #pragma once
  2.  
  3. namespace liczbynaslowa {
  4.  
  5.     using namespace System;
  6.     using namespace System::ComponentModel;
  7.     using namespace System::Collections;
  8.     using namespace System::Windows::Forms;
  9.     using namespace System::Data;
  10.     using namespace System::Drawing;
  11.  
  12.     /// <summary>
  13.     /// Summary for Form1
  14.     /// </summary>
  15.     public ref class Form1 : public System::Windows::Forms::Form
  16.     {
  17.     public:
  18.         Form1(void)
  19.         {
  20.             InitializeComponent();
  21.             //
  22.             //TODO: Add the constructor code here
  23.             //
  24.         }
  25.  
  26.     protected:
  27.         /// <summary>
  28.         /// Clean up any resources being used.
  29.         /// </summary>
  30.         ~Form1()
  31.         {
  32.             if (components)
  33.             {
  34.                 delete components;
  35.             }
  36.         }
  37.     private: System::Windows::Forms::Button^  button1;
  38.     protected:
  39.     private: System::Windows::Forms::Label^  label1;
  40.     private: System::Windows::Forms::Label^  label2;
  41.     private: System::Windows::Forms::Label^  label3;
  42.     private: System::Windows::Forms::TextBox^  textBox1;
  43.  
  44.     private:
  45.         /// <summary>
  46.         /// Required designer variable.
  47.         /// </summary>
  48.         System::ComponentModel::Container ^components;
  49.  
  50. #pragma region Windows Form Designer generated code
  51.         /// <summary>
  52.         /// Required method for Designer support - do not modify
  53.         /// the contents of this method with the code editor.
  54.         /// </summary>
  55.         void InitializeComponent(void)
  56.         {
  57.             this->button1 = (gcnew System::Windows::Forms::Button());
  58.             this->label1 = (gcnew System::Windows::Forms::Label());
  59.             this->label2 = (gcnew System::Windows::Forms::Label());
  60.             this->label3 = (gcnew System::Windows::Forms::Label());
  61.             this->textBox1 = (gcnew System::Windows::Forms::TextBox());
  62.             this->SuspendLayout();
  63.             //
  64.             // button1
  65.             //
  66.             this->button1->Location = System::Drawing::Point(16, 66);
  67.             this->button1->Name = L"button1";
  68.             this->button1->Size = System::Drawing::Size(75, 23);
  69.             this->button1->TabIndex = 0;
  70.             this->button1->Text = L"Zamień";
  71.             this->button1->UseVisualStyleBackColor = true;
  72.             this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
  73.             //
  74.             // label1
  75.             //
  76.             this->label1->AutoSize = true;
  77.             this->label1->Location = System::Drawing::Point(13, 13);
  78.             this->label1->Name = L"label1";
  79.             this->label1->Size = System::Drawing::Size(38, 13);
  80.             this->label1->TabIndex = 1;
  81.             this->label1->Text = L"Liczba";
  82.             //
  83.             // label2
  84.             //
  85.             this->label2->AutoSize = true;
  86.             this->label2->Location = System::Drawing::Point(126, 13);
  87.             this->label2->Name = L"label2";
  88.             this->label2->Size = System::Drawing::Size(78, 13);
  89.             this->label2->TabIndex = 2;
  90.             this->label2->Text = L"Liczba słownie";
  91.             //
  92.             // label3
  93.             //
  94.             this->label3->AutoSize = true;
  95.             this->label3->Location = System::Drawing::Point(129, 30);
  96.             this->label3->Name = L"label3";
  97.             this->label3->Size = System::Drawing::Size(0, 13);
  98.             this->label3->TabIndex = 3;
  99.             //
  100.             // textBox1
  101.             //
  102.             this->textBox1->Location = System::Drawing::Point(16, 30);
  103.             this->textBox1->MaxLength = 5;
  104.             this->textBox1->Name = L"textBox1";
  105.             this->textBox1->Size = System::Drawing::Size(51, 20);
  106.             this->textBox1->TabIndex = 4;
  107.             //
  108.             // Form1
  109.             //
  110.             this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  111.             this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  112.             this->ClientSize = System::Drawing::Size(572, 98);
  113.             this->Controls->Add(this->textBox1);
  114.             this->Controls->Add(this->label3);
  115.             this->Controls->Add(this->label2);
  116.             this->Controls->Add(this->label1);
  117.             this->Controls->Add(this->button1);
  118.             this->Name = L"Form1";
  119.             this->Text = L"Form1";
  120.             this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
  121.             this->ResumeLayout(false);
  122.             this->PerformLayout();
  123.  
  124.         }
  125. #pragma endregion
  126.     private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
  127.              }
  128.     private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
  129.                 int j=textBox1->Text->Length;
  130.                 bool bad=false;
  131.                 String^ liczba="";
  132.                 for (int i=0; i<j; i++)
  133.                 {
  134.                     if (!bad)
  135.                     {
  136.                         if (textBox1->Text[i]>=48 && textBox1->Text[i]<=57)
  137.                         {
  138.                            
  139.                         }
  140.                         else
  141.                         {  
  142.                             bad=true;
  143.                             label3->Text="";
  144.                             MessageBox::Show("Podano nieprawidłową liczbę!","Aplikacja", MessageBoxButtons::OK,MessageBoxIcon::Asterisk);
  145.                         }
  146.                     }
  147.                 }
  148.                 if (!bad)
  149.                 {
  150.                     if (5-j==0)
  151.                     {
  152.                         if (textBox1->Text[0]=='1')
  153.                         {
  154.                             if (textBox1->Text[1]=='0')
  155.                             {
  156.                                 liczba="Dziesięć";
  157.                             }
  158.                             if (textBox1->Text[1]=='1')
  159.                             {
  160.                                 liczba="Jedenaście";
  161.                             }
  162.                             if (textBox1->Text[1]=='2')
  163.                             {
  164.                                 liczba="Dwanaście";
  165.                             }
  166.                             if (textBox1->Text[1]=='3')
  167.                             {
  168.                                 liczba="Trzynaście";
  169.                             }
  170.                             if (textBox1->Text[1]=='4')
  171.                             {
  172.                                 liczba="Czternaścoe";
  173.                             }
  174.                             if (textBox1->Text[1]=='5')
  175.                             {
  176.                                 liczba="Piętnaście";
  177.                             }
  178.                             if (textBox1->Text[1]=='6')
  179.                             {
  180.                                 liczba="Szesnaście";
  181.                             }
  182.                             if (textBox1->Text[1]=='7')
  183.                             {
  184.                                 liczba="Siedemnaście";
  185.                             }
  186.                             if (textBox1->Text[1]=='8')
  187.                             {
  188.                                 liczba="Osiemnaście";
  189.                             }
  190.                             if (textBox1->Text[1]=='9')
  191.                             {
  192.                                 liczba="Dziewiętnaście";
  193.                             }
  194.                         }
  195.                         if (textBox1->Text[0]=='2')
  196.                         {
  197.                             liczba="Dwadzieścia";
  198.                         }
  199.                         if (textBox1->Text[0]=='3')
  200.                         {
  201.                             liczba="Trzydzieści";
  202.                         }
  203.                         if (textBox1->Text[0]=='4')
  204.                         {
  205.                             liczba="Czterdzieści";
  206.                         }
  207.                         if (textBox1->Text[0]=='5')
  208.                         {
  209.                             liczba="Pięćdziesiąt";
  210.                         }
  211.                         if (textBox1->Text[0]=='6')
  212.                         {
  213.                             liczba="Sześćdziesiąt";
  214.                         }
  215.                         if (textBox1->Text[0]=='7')
  216.                         {
  217.                             liczba="Siedemdziesiąt";
  218.                         }
  219.                         if (textBox1->Text[0]=='8')
  220.                         {
  221.                             liczba="Osiemdziesiąt";
  222.                         }
  223.                         if (textBox1->Text[0]=='9')
  224.                         {
  225.                             liczba="Dziewięcdziesiąt";
  226.                         }
  227.  
  228.                         if (textBox1->Text[0]!='1')
  229.                         {
  230.                             if (textBox1->Text[1]=='1')
  231.                             {
  232.                                 liczba=liczba+"jeden";
  233.                             }
  234.                             if (textBox1->Text[1]=='2')
  235.                             {
  236.                                 liczba=liczba+"dwa";
  237.                             }
  238.                             if (textBox1->Text[1]=='3')
  239.                             {
  240.                                 liczba=liczba+"trzy";
  241.                             }
  242.                             if (textBox1->Text[1]=='4')
  243.                             {
  244.                                 liczba=liczba+"cztery";
  245.                             }
  246.                             if (textBox1->Text[1]=='5')
  247.                             {
  248.                                 liczba=liczba+"pięć";
  249.                             }
  250.                             if (textBox1->Text[1]=='6')
  251.                             {
  252.                                 liczba=liczba+"sześć";
  253.                             }
  254.                             if (textBox1->Text[1]=='7')
  255.                             {
  256.                                 liczba=liczba+"siedem";
  257.                             }
  258.                             if (textBox1->Text[1]=='8')
  259.                             {
  260.                                 liczba=liczba+"osiem";
  261.                             }
  262.                             if (textBox1->Text[1]=='9')
  263.                             {
  264.                                 liczba=liczba+"dziewięć";
  265.                             }
  266.                         }
  267.                         if (liczba->Length>0)
  268.                             liczba=liczba+" tysięcy ";
  269.                         if (textBox1->Text[2]=='1')
  270.                         {
  271.                             liczba=liczba+"sto";
  272.                         }
  273.                         if (textBox1->Text[2]=='2')
  274.                         {
  275.                             liczba=liczba+"dwieście";
  276.                         }
  277.                         if (textBox1->Text[2]=='3')
  278.                         {
  279.                             liczba=liczba+"trzysta";
  280.                         }
  281.                         if (textBox1->Text[2]=='4')
  282.                         {
  283.                             liczba=liczba+"czterysta";
  284.                         }
  285.                         if (textBox1->Text[2]=='5')
  286.                         {
  287.                             liczba=liczba+"pięćset";
  288.                         }
  289.                         if (textBox1->Text[2]=='6')
  290.                         {
  291.                             liczba=liczba+"sześćset";
  292.                         }
  293.                         if (textBox1->Text[2]=='7')
  294.                         {
  295.                             liczba=liczba+"siedemset";
  296.                         }
  297.                         if (textBox1->Text[2]=='8')
  298.                         {
  299.                             liczba=liczba+"osiemset";
  300.                         }
  301.                         if (textBox1->Text[2]=='9')
  302.                         {
  303.                             liczba=liczba+"dziewięćset";
  304.                         }
  305.                        
  306.                         if (textBox1->Text[3]=='1')
  307.                         {
  308.                             if (textBox1->Text[4]=='0')
  309.                             {
  310.                                 liczba=liczba+"dziesięć";
  311.                             }
  312.                             if (textBox1->Text[4]=='1')
  313.                             {
  314.                                 liczba=liczba+"jedenaście";
  315.                             }
  316.                             if (textBox1->Text[4]=='2')
  317.                             {
  318.                                 liczba=liczba+"dwanaście";
  319.                             }
  320.                             if (textBox1->Text[4]=='3')
  321.                             {
  322.                                 liczba=liczba+"trzynaście";
  323.                             }
  324.                             if (textBox1->Text[4]=='4')
  325.                             {
  326.                                 liczba=liczba+"czternaścoe";
  327.                             }
  328.                             if (textBox1->Text[4]=='5')
  329.                             {
  330.                                 liczba=liczba+"piętnaście";
  331.                             }
  332.                             if (textBox1->Text[4]=='6')
  333.                             {
  334.                                 liczba=liczba+"szesnaście";
  335.                             }
  336.                             if (textBox1->Text[4]=='7')
  337.                             {
  338.                                 liczba=liczba+"siedemnaście";
  339.                             }
  340.                             if (textBox1->Text[4]=='8')
  341.                             {
  342.                                 liczba=liczba+"osiemnaście";
  343.                             }
  344.                             if (textBox1->Text[4]=='9')
  345.                             {
  346.                                 liczba=liczba+"dziewiętnaście";
  347.                             }
  348.                         }
  349.                         if (textBox1->Text[3]=='2')
  350.                         {
  351.                             liczba=liczba+"dwadzieścia";
  352.                         }
  353.                         if (textBox1->Text[3]=='3')
  354.                         {
  355.                             liczba=liczba+"trzydzieści";
  356.                         }
  357.                         if (textBox1->Text[3]=='4')
  358.                         {
  359.                             liczba=liczba+"czterdzieści";
  360.                         }
  361.                         if (textBox1->Text[3]=='5')
  362.                         {
  363.                             liczba=liczba+"pięćdziesiąt";
  364.                         }
  365.                         if (textBox1->Text[3]=='6')
  366.                         {
  367.                             liczba=liczba+"sześćdziesiąt";
  368.                         }
  369.                         if (textBox1->Text[3]=='7')
  370.                         {
  371.                             liczba=liczba+"siedemdziesiąt";
  372.                         }
  373.                         if (textBox1->Text[3]=='8')
  374.                         {
  375.                             liczba=liczba+"osiemdziesiąt";
  376.                         }
  377.                         if (textBox1->Text[3]=='9')
  378.                         {
  379.                             liczba=liczba+"dziewięcdziesiąt";
  380.                         }
  381.                         if (textBox1->Text[3]!='1')
  382.                         {
  383.                             if (textBox1->Text[4]=='1')
  384.                             {
  385.                                 liczba=liczba+"jeden";
  386.                             }
  387.                             if (textBox1->Text[4]=='2')
  388.                             {
  389.                                 liczba=liczba+"dwa";
  390.                             }
  391.                             if (textBox1->Text[4]=='3')
  392.                             {
  393.                                 liczba=liczba+"trzy";
  394.                             }
  395.                             if (textBox1->Text[4]=='4')
  396.                             {
  397.                                 liczba=liczba+"cztery";
  398.                             }
  399.                             if (textBox1->Text[4]=='5')
  400.                             {
  401.                                 liczba=liczba+"pięć";
  402.                             }
  403.                             if (textBox1->Text[4]=='6')
  404.                             {
  405.                                 liczba=liczba+"sześć";
  406.                             }
  407.                             if (textBox1->Text[4]=='7')
  408.                             {
  409.                                 liczba=liczba+"siedem";
  410.                             }
  411.                             if (textBox1->Text[4]=='8')
  412.                             {
  413.                                 liczba=liczba+"osiem";
  414.                             }
  415.                             if (textBox1->Text[4]=='9')
  416.                             {
  417.                                 liczba=liczba+"dziewięć";
  418.                             }
  419.                         }
  420.                     }
  421.                 label3->Text=liczba;
  422.                 }
  423.  
  424.              }
  425. };
  426. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement