fork download
  1. // Przyciski:
  2.  
  3. private: System::Void zero_Click(System::Object^ sender, System::EventArgs^ e) {
  4. this->textBox1->Text+="0";
  5. this->textBox2->Text+="0";
  6. this->textBox4->Text="0";
  7. }
  8. private: System::Void jeden_Click(System::Object^ sender, System::EventArgs^ e) {
  9. this->textBox1->Text+="1";
  10. this->textBox2->Text+="1";
  11. this->textBox4->Text="0";
  12. }
  13. private: System::Void dwa_Click(System::Object^ sender, System::EventArgs^ e) {
  14. this->textBox1->Text+="2";
  15. this->textBox2->Text+="2";
  16. this->textBox4->Text="0";
  17. }
  18. private: System::Void trzy_Click(System::Object^ sender, System::EventArgs^ e) {
  19. this->textBox1->Text+="3";
  20. this->textBox2->Text+="3";
  21. this->textBox4->Text="0";
  22. }
  23. private: System::Void cztery_Click(System::Object^ sender, System::EventArgs^ e) {
  24. this->textBox1->Text+="4";
  25. this->textBox2->Text+="4";
  26. this->textBox4->Text="0";
  27. }
  28. private: System::Void piec_Click(System::Object^ sender, System::EventArgs^ e) {
  29. this->textBox1->Text+="5";
  30. this->textBox2->Text+="5";
  31. this->textBox4->Text="0";
  32. }
  33. private: System::Void szesc_Click(System::Object^ sender, System::EventArgs^ e) {
  34. this->textBox1->Text+="6";
  35. this->textBox2->Text+="6";
  36. this->textBox4->Text="0";
  37. }
  38. private: System::Void siedem_Click(System::Object^ sender, System::EventArgs^ e) {
  39. this->textBox1->Text+="7";
  40. this->textBox2->Text+="7";
  41. this->textBox4->Text="0";
  42. }
  43. private: System::Void osiem_Click(System::Object^ sender, System::EventArgs^ e) {
  44. this->textBox1->Text+="8";
  45. this->textBox2->Text+="8";
  46. this->textBox4->Text="0";
  47. }
  48. private: System::Void dziewiec_Click(System::Object^ sender, System::EventArgs^ e) {
  49. this->textBox1->Text+="9";
  50. this->textBox2->Text+="9";
  51. this->textBox4->Text="0";
  52. }
  53. private: System::Void clear_Click(System::Object^ sender, System::EventArgs^ e) {
  54. textBox1->Clear();
  55. textBox2->Clear();
  56. textBox3->Clear();
  57. this->textBox5->Text="0";
  58. this-> textBox4->Text="0";
  59. label1->Text="Kalkulator";
  60. }
  61. private: System::Void zamknijToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
  62. Close();
  63. }
  64. private: System::Void przecinek_Click(System::Object^ sender, System::EventArgs^ e) {
  65. int a = 0;
  66. int lent = textBox1->Text->Length;
  67. for(int i = 0; i< lent; i=i+1){
  68. textBox4->Text = textBox1->Text;
  69. if(textBox4->Text[i].ToString() == ","){
  70. a = 1;}
  71. }
  72. if (a==1){ MessageBox::Show("Nie mozna wstawic przecinka!");}
  73. else { if(textBox1->Text==""){
  74. this->textBox1->Text+="0,";
  75. this->textBox2->Text+="0,";
  76. }else {
  77. this->textBox1->Text+=",";
  78. this->textBox2->Text+=",";
  79. }}
  80.  
  81. }
  82.  
  83. private: System::Void dodac_Click(System::Object^ sender, System::EventArgs^ e) {
  84. if(textBox2->Text!=""){
  85. if(label1->Text=="/"){
  86. double a=1;
  87. if(textBox1->Text!=""){
  88. a=Convert::ToDouble(textBox1->Text);
  89. if(a==0)
  90. {MessageBox::Show("Nie dzielimy przez 0!");}
  91. else{
  92. textBox1->Clear();
  93. textBox2->Text+="+";
  94. label1->Text="+";
  95. textBox4->Text="1";
  96. } }else {textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  97. textBox2->Text+="+";
  98. label1->Text="+";}
  99.  
  100. }
  101.  
  102. else {
  103. if(textBox4->Text=="1"){
  104. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  105. textBox2->Text+="+";
  106. label1->Text="+";}
  107. else{
  108. this->textBox4->Text="0";
  109. textBox1->Clear();
  110. textBox2->Text+="+";
  111. label1->Text="+";
  112. textBox4->Text="1";
  113. }}}}
  114. private: System::Void odejmowanie_Click(System::Object^ sender, System::EventArgs^ e) {
  115. if(textBox2->Text!=""){
  116. if(label1->Text=="/"){
  117. double a=1;
  118. if(textBox1->Text!=""){
  119. a=Convert::ToDouble(textBox1->Text);
  120. if(a==0)
  121. {MessageBox::Show("Nie dzielimy przez 0!");}
  122. else{
  123. textBox1->Clear();
  124. textBox2->Text+="-";
  125. label1->Text="-";
  126. textBox4->Text="1";
  127. } }else {textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  128. textBox2->Text+="-";
  129. label1->Text="-";}
  130.  
  131. }
  132.  
  133. else {
  134. if(textBox4->Text=="1"){
  135. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  136. textBox2->Text+="-";
  137. label1->Text="-";}
  138. else{
  139. this->textBox4->Text="0";
  140. textBox1->Clear();
  141. textBox2->Text+="-";
  142. label1->Text="-";
  143. textBox4->Text="1";
  144. }}}}
  145. private: System::Void mnozenie_Click(System::Object^ sender, System::EventArgs^ e) {
  146. if(textBox2->Text!=""){
  147. if(label1->Text=="/"){
  148. double a=1;
  149. if(textBox1->Text!=""){
  150. a=Convert::ToDouble(textBox1->Text);
  151. if(a==0)
  152. {MessageBox::Show("Nie dzielimy przez 0!");}
  153. else{
  154. textBox1->Clear();
  155. textBox2->Text+="*";
  156. label1->Text="*";
  157. textBox4->Text="1";
  158. } }else {textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  159. textBox2->Text+="*";
  160. label1->Text="*";}
  161.  
  162. }
  163.  
  164. else {
  165. if(textBox4->Text=="1"){
  166. textBox2->Text=textBox2->Text->Substring(0, textBox2->Text->Length -1);
  167. textBox2->Text+="*";
  168. label1->Text="*";}
  169. else{
  170. this->textBox4->Text="0";
  171. textBox1->Clear();
  172. textBox2->Text+="*";
  173. label1->Text="*";
  174. textBox4->Text="1";
  175. }}}}
  176. private: System::Void dzielenie_Click(System::Object^ sender, System::EventArgs^ e) {
  177. if(textBox2->Text!=""){
  178. if(label1->Text=="/"){
  179. double a;
  180. if(textBox1->Text!=""){
  181. a=Convert::ToDouble(textBox1->Text);
  182. if(a==0)
  183. {MessageBox::Show("Nie dzielimy przez 0!");}
  184. else{
  185. textBox1->Clear();
  186. textBox2->Text+="/";
  187. label1->Text="/";
  188. textBox4->Text="1";
  189. } } else {textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  190. textBox2->Text+="/";
  191. label1->Text="/";}
  192.  
  193.  
  194. }
  195.  
  196. else {
  197. if(textBox4->Text=="1"){
  198. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  199. textBox2->Text+="/";
  200. label1->Text="/";}
  201. else{
  202. this->textBox4->Text="0";
  203. textBox1->Clear();
  204. textBox2->Text+="/";
  205. label1->Text="/";
  206. textBox4->Text="1";
  207. }}}}
  208.  
  209.  
  210.  
  211. private: System::Void pierwiastek_Click(System::Object^ sender, System::EventArgs^ e) {
  212. if(label1->Text=="Kalkulator"){ this->textBox4->Text="0";
  213. if(textBox1->Text==""){ MessageBox::Show("Nie wpisano żadnej liczby");
  214. } else {
  215. double a,b;
  216. int lent=textBox1->Text->Length;
  217. a = Convert::ToDouble (textBox1->Text);
  218. b = Math::Sqrt(a);
  219. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -lent);
  220. textBox1->Text=Convert::ToString(b);
  221. textBox2->Text+=Convert::ToString(b);
  222. this->textBox5->Text="1";
  223. label1->Text="sqrt";
  224. }} else {
  225. this->textBox4->Text="0";
  226. if(textBox1->Text==""){ MessageBox::Show("Nie wpisano żadnej liczby");
  227. } else {
  228. double a,b;
  229. int lent=textBox1->Text->Length;
  230. a = Convert::ToDouble (textBox1->Text);
  231. b = Math::Sqrt(a);
  232. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -lent);
  233. textBox1->Text=Convert::ToString(b);
  234. textBox2->Text+=Convert::ToString(b);
  235. this->textBox5->Text="1";
  236. } }
  237. }
  238.  
  239. private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
  240. int lent = textBox1->Text->Length;
  241. int a = lent -1;
  242. if(lent>=1){
  243. textBox1->Text = textBox1->Text->Substring(0, textBox1->Text->Length -1);
  244. textBox2->Text = textBox2->Text->Substring(0, textBox2->Text->Length -1);
  245. }
  246.  
  247.  
  248.  
  249. }
  250. private: System::Void potega_Click(System::Object^ sender, System::EventArgs^ e) {
  251. if(label1->Text=="Kalkulator"){ this->textBox4->Text="0";
  252. if(textBox1->Text==""){ MessageBox::Show("Nie wpisano żadnej liczby");
  253. } else {
  254. double a,b;
  255. int lent=textBox1->Text->Length;
  256. a=Convert::ToDouble(textBox1->Text);
  257. b=a*a;
  258. // for(int i=1; i<=lent; i++)
  259. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -lent);
  260. textBox1->Text=Convert::ToString(b);
  261. textBox2->Text+=Convert::ToString(b);
  262. this->textBox5->Text="1";
  263. label1->Text="^2";
  264. }} else {
  265. this->textBox4->Text="0";
  266. if(textBox1->Text==""){ MessageBox::Show("Nie wpisano żadnej liczby");
  267. } else {
  268. double a,b;
  269. int lent=textBox1->Text->Length;
  270. a=Convert::ToDouble(textBox1->Text);
  271. b=a*a;
  272. // for(int i=1; i<=lent; i++)
  273. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -lent);
  274. textBox1->Text=Convert::ToString(b);
  275. textBox2->Text+=Convert::ToString(b);
  276. this->textBox5->Text="1";
  277. label1->Text="^2";
  278. }
  279. }
  280.  
  281. }
  282. private: System::Void pi_Click(System::Object^ sender, System::EventArgs^ e) {
  283. this->textBox1->Text+="3,14159";
  284. this->textBox2->Text+="3,14159";
  285. this->textBox4->Text="0";
  286. }
  287. private: System::Void Euler_Click(System::Object^ sender, System::EventArgs^ e) {
  288. this->textBox1->Text+="2,71828";
  289. this->textBox2->Text+="2,71828";
  290. this->textBox4->Text="0";
  291. }
  292. private: System::Void sinus_Click(System::Object^ sender, System::EventArgs^ e) {
  293. if(textBox1->Text==""){
  294. MessageBox::Show("Nie wpisano zadnej liczby");
  295. }
  296. else { double q;
  297. q = Convert::ToDouble (textBox1->Text);
  298. while (q>360){
  299. q = q - 360;
  300. }
  301. textBox1->Text=Convert::ToString(q);
  302.  
  303. if(textBox1->Text=="180"){
  304. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  305. double a;
  306. a = Convert::ToDouble (textBox1->Text);
  307. x = 0;
  308. textBox1->Text=Convert::ToString(x);
  309. textBox2->Text+=Convert::ToString(x);
  310. this->textBox5->Text="1";}
  311. else {if(textBox1->Text=="360"){
  312. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  313. double a;
  314. a = Convert::ToDouble (textBox1->Text);
  315. x = 0;
  316. textBox1->Text=Convert::ToString(x);
  317. textBox2->Text+=Convert::ToString(x);
  318. this->textBox5->Text="1";}
  319. else {
  320. if(textBox1->Text->Length==1){
  321. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  322. double a;
  323. a = Convert::ToDouble (textBox1->Text);
  324. x = Math::Sin(a*3.14159265358979/180);
  325. textBox1->Text=Convert::ToString(x);
  326. textBox2->Text+=Convert::ToString(x);
  327. this->textBox5->Text="1";}
  328. else{
  329. if(textBox1->Text->Length==2){
  330. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -2);
  331. double a;
  332. a = Convert::ToDouble (textBox1->Text);
  333. x = Math::Sin(a*3.14159265358979/180);
  334. textBox1->Text=Convert::ToString(x);
  335. textBox2->Text+=Convert::ToString(x);
  336. }
  337. else{
  338. if(textBox1->Text->Length==3){
  339. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  340. double a;
  341. a = Convert::ToDouble (textBox1->Text);
  342. x = Math::Sin(a*3.14159265358979/180);
  343. textBox1->Text=Convert::ToString(x);
  344. textBox2->Text+=Convert::ToString(x);
  345. }
  346. }
  347. }}}
  348. }}
  349. private: System::Void cosinus_Click(System::Object^ sender, System::EventArgs^ e) {
  350. if(textBox1->Text==""){
  351. MessageBox::Show("Nie wpisano zadnej liczby");
  352. }
  353. else { double q;
  354. q = Convert::ToDouble (textBox1->Text);
  355. while (q>360){
  356. q = q - 360;
  357. }
  358. textBox1->Text=Convert::ToString(q);
  359.  
  360. if(textBox1->Text=="90"){
  361. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -2);
  362. double a;
  363. a = Convert::ToDouble (textBox1->Text);
  364. x = 0;
  365. textBox1->Text=Convert::ToString(x);
  366. textBox2->Text+=Convert::ToString(x);
  367. this->textBox5->Text="1";}
  368. else{if(textBox1->Text=="60"){
  369. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -2);
  370. double a;
  371. a = Convert::ToDouble (textBox1->Text);
  372. x = 0.5;
  373. textBox1->Text=Convert::ToString(x);
  374. textBox2->Text+=Convert::ToString(x);
  375. this->textBox5->Text="1";
  376. }
  377. else {if(textBox1->Text=="270"){
  378. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  379. double a;
  380. a = Convert::ToDouble (textBox1->Text);
  381. x = 0;
  382. textBox1->Text=Convert::ToString(x);
  383. textBox2->Text+=Convert::ToString(x);
  384. this->textBox5->Text="1";}
  385. else {
  386. if(textBox1->Text->Length==1){
  387. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  388. double a;
  389. a = Convert::ToDouble (textBox1->Text);
  390. x = Math::Sin(a*3.14159265358979/180);
  391. textBox1->Text=Convert::ToString(x);
  392. textBox2->Text+=Convert::ToString(x);
  393. this->textBox5->Text="1";}
  394. else{
  395. if(textBox1->Text->Length==2){
  396. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -2);
  397. double a;
  398. a = Convert::ToDouble (textBox1->Text);
  399. x = Math::Cos(a*3.14159265358979/180);
  400. textBox1->Text=Convert::ToString(x);
  401. textBox2->Text+=Convert::ToString(x);
  402. }
  403. else{
  404. if(textBox1->Text->Length==3){
  405. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  406. double a;
  407. a = Convert::ToDouble (textBox1->Text);
  408. x = Math::Sin(a*3.14159265358979/180);
  409. textBox1->Text=Convert::ToString(x);
  410. textBox2->Text+=Convert::ToString(x);
  411. }
  412. }
  413. }}}
  414. }}}
  415.  
  416. private: System::Void tangens_Click(System::Object^ sender, System::EventArgs^ e) {
  417. if(textBox1->Text==""){
  418. MessageBox::Show("Nie wpisano zadnej liczby");
  419. }
  420. else { double q;
  421. q = Convert::ToDouble (textBox1->Text);
  422. while (q>360){
  423. q = q - 360;
  424. }
  425. textBox1->Text=Convert::ToString(q);
  426.  
  427. if(textBox1->Text=="180"){
  428. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  429. double a;
  430. a = Convert::ToDouble (textBox1->Text);
  431. x = 0;
  432. textBox1->Text=Convert::ToString(x);
  433. textBox2->Text+=Convert::ToString(x);
  434. this->textBox5->Text="1";}
  435. else {if(textBox1->Text=="360"){
  436. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  437. double a;
  438. a = Convert::ToDouble (textBox1->Text);
  439. x = 0;
  440. textBox1->Text=Convert::ToString(x);
  441. textBox2->Text+=Convert::ToString(x);
  442. this->textBox5->Text="1";}
  443. else{if(textBox1->Text=="90"){
  444. MessageBox::Show("Nie ma tg z 90");
  445. this->textBox5->Text="1";
  446.  
  447. }else{if(textBox1->Text=="270"){
  448. MessageBox::Show("Nie ma tg z 90");
  449. this->textBox5->Text="1";
  450. }else{if(textBox1->Text=="45"){
  451. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -2);
  452. double a;
  453. a = Convert::ToDouble (textBox1->Text);
  454. x = 1;
  455. textBox1->Text=Convert::ToString(x);
  456. textBox2->Text+=Convert::ToString(x);
  457. this->textBox5->Text="1";}
  458.  
  459. else{
  460. if(textBox1->Text->Length==1){
  461. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  462. double a;
  463. a = Convert::ToDouble (textBox1->Text);
  464. x = Math::Sin(a*3.14159265358979/180);
  465. textBox1->Text=Convert::ToString(x);
  466. textBox2->Text+=Convert::ToString(x);
  467. this->textBox5->Text="1";}
  468. else{
  469. if(textBox1->Text->Length==2){
  470. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -2);
  471. double a;
  472. a = Convert::ToDouble (textBox1->Text);
  473. x = Math::Cos(a*3.14159265358979/180);
  474. textBox1->Text=Convert::ToString(x);
  475. textBox2->Text+=Convert::ToString(x);
  476. }
  477. else{
  478. if(textBox1->Text->Length==3){
  479. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -3);
  480. double a;
  481. a = Convert::ToDouble (textBox1->Text);
  482. x = Math::Tan(a*3.14159265358979/180);
  483. textBox1->Text=Convert::ToString(x);
  484. textBox2->Text+=Convert::ToString(x);
  485. }
  486. }
  487. }}}
  488. }}}}}
  489.  
  490. private: System::Void rownosc_Click(System::Object^ sender, System::EventArgs^ e) {
  491. if(textBox2->Text!=""){
  492. if(label1->Text=="/"){
  493. double a=1;
  494. if(textBox1->Text!=""){
  495. a=Convert::ToDouble(textBox1->Text);
  496. if(a==0)
  497. {MessageBox::Show("Nie dzielimy przez 0!");}
  498. else{
  499. textBox1->Clear();
  500. textBox2->Text+="=";
  501. label1->Text="=";
  502. textBox4->Text="1";
  503. } }else {textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  504. textBox2->Text+="=";
  505. label1->Text="=";}
  506.  
  507. }
  508.  
  509. else {
  510. if(textBox4->Text=="1"){
  511. textBox2->Text =textBox2->Text->Substring(0, textBox2->Text->Length -1);
  512. textBox2->Text+="=";
  513. label1->Text="=";}
  514. else{
  515. this->textBox4->Text="0";
  516. textBox1->Clear();
  517. textBox2->Text+="=";
  518. label1->Text="=";
  519. textBox4->Text="1";
  520. }}}
  521.  
  522. if(label1->Text=="="){
  523. textBox3->Text=textBox2->Text->Substring(0, textBox2->Text->Length -1);
  524. int lent1 = textBox3->Text->Length;
  525. // char b;
  526. // for(int i = 0; i< lent1; i=i+1){
  527.  
  528. // c[i] = textBox3->Text[i].ToString();
  529. // }
  530.  
  531.  
  532. textBox3->Text=Convert::ToString(Wynik.RPN(textBox3->Text)); //Napisz String ( z dużej litery, żeby działało, to system string będzie)
  533. // Convert::ToString
  534. } }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:1: error: expected unqualified-id before ‘private’
 private: System::Void zero_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:8:1: error: expected unqualified-id before ‘private’
 private: System::Void jeden_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:13:1: error: expected unqualified-id before ‘private’
 private: System::Void dwa_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:18:1: error: expected unqualified-id before ‘private’
 private: System::Void trzy_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:23:1: error: expected unqualified-id before ‘private’
 private: System::Void cztery_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:28:1: error: expected unqualified-id before ‘private’
 private: System::Void piec_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:33:1: error: expected unqualified-id before ‘private’
 private: System::Void szesc_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:38:1: error: expected unqualified-id before ‘private’
 private: System::Void siedem_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:43:1: error: expected unqualified-id before ‘private’
 private: System::Void osiem_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:48:1: error: expected unqualified-id before ‘private’
 private: System::Void dziewiec_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:53:1: error: expected unqualified-id before ‘private’
 private: System::Void clear_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:61:1: error: expected unqualified-id before ‘private’
 private: System::Void zamknijToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
prog.cpp:64:1: error: expected unqualified-id before ‘private’
 private: System::Void przecinek_Click(System::Object^  sender, System::EventArgs^  e) {
 ^
stdout
Standard output is empty