From 07daf55ec2a220c37a963e1bb003eaa28b9cd94c Mon Sep 17 00:00:00 2001 From: aki Date: Thu, 15 Nov 2012 12:50:03 +0600 Subject: [PATCH 1/4] =?UTF-8?q?=D0=BA=D1=80=D0=B8=D0=B2=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=20=D0=B2=20=D0=BE=D0=B1=D1=89=D0=B5=D0=BC-=D1=82?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calc.html | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 calc.html diff --git a/calc.html b/calc.html new file mode 100644 index 0000000..a349611 --- /dev/null +++ b/calc.html @@ -0,0 +1,104 @@ + + + + + + + + +
+ +
+
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
0
+
+
+
+
+
-
+
*
+
/
+
=
+
+ + + + + + From 4a5178a54771a4b4273d9a975e546c578e5daa34 Mon Sep 17 00:00:00 2001 From: aki Date: Thu, 15 Nov 2012 13:03:20 +0600 Subject: [PATCH 2/4] more~ --- calc.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/calc.html b/calc.html index a349611..4f8a715 100644 --- a/calc.html +++ b/calc.html @@ -83,14 +83,15 @@ operation = op; $('#inout').text(x + ' ' + operation); } else { + var res; switch(operation){ - case '+': $('#inout').text(x + y); break; - case '-': $('#inout').text(x - y); break; - case '*': $('#inout').text(x * y); break; - case '/': if(y != 0) $('#inout').text(x / y); else $('#inout').text('division by zero!'); break; + case '+':res = x+y; $('#inout').text(res); break; + case '-': res = x-y; $('#inout').text(res); break; + case '*': res = x*y; $('#inout').text(res); break; + case '/': if(y != 0){ res=x/y; $('#inout').text(res); } else $('#inout').text('division by zero!'); break; default: $('#inout').text('something wrong'); } - x = 0; y = 0; operation = undefined; + x = res; y = 0; operation = undefined; } }); From 36d7278bd0e50701833a24ca8336caefdec6a9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=8F=20=D0=A4=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=D1=8F=D0=BD=D0=BE=D0=B2=D0=B0?= Date: Thu, 15 Nov 2012 14:22:21 +0500 Subject: [PATCH 3/4] =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D0=BE?= =?UTF-8?q?=D0=B4=D0=BD=D0=BE=D0=B7=D0=BD=D0=B0=D1=87=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D1=87=D0=B8=D1=81=D0=BB=D0=B0=20=D1=81=D1=87=D0=B8=D1=82=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=20-)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calc.html | 214 +++++++++++++++++++++++++++--------------------------- 1 file changed, 109 insertions(+), 105 deletions(-) diff --git a/calc.html b/calc.html index 4f8a715..b4b2b4a 100644 --- a/calc.html +++ b/calc.html @@ -1,105 +1,109 @@ - - - - - - - - -
- -
-
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
0
-
-
-
+
-
-
-
*
-
/
-
=
-
- - - - - - + + + + + + + + +
+ +
+
+
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
0
+
+
+
+
+
-
+
*
+
/
+
=
+
+ + + + + + From be0b1739cd1790d7d53894f409b18e87cb4eb9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9D=D0=B0=D1=81=D1=82=D1=8F=20=D0=A4=D0=B0=D1=82=D1=8C?= =?UTF-8?q?=D1=8F=D0=BD=D0=BE=D0=B2=D0=B0?= Date: Thu, 15 Nov 2012 14:33:40 +0500 Subject: [PATCH 4/4] =?UTF-8?q?=D0=B2=D0=BE=D1=82=20=D1=82=D0=B5=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D1=8C=20=D1=82=D0=BE=D1=87=D0=BD=D0=BE=20=D1=81?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D1=82=20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/calc.html b/calc.html index b4b2b4a..01f3e14 100644 --- a/calc.html +++ b/calc.html @@ -71,10 +71,10 @@ $('div.number').click(function(event) { if(operation === undefined) { flag = false; - x = parseFloat($(this).attr('id')); + x = x*10 + parseFloat($(this).attr('id')); $('#inout').text(x); } else { - y = parseFloat($(this).attr('id')); + y = y*10 + parseFloat($(this).attr('id')); $('#inout').text(x + ' ' + operation + ' ' + y); }