From c7a5b8df159fd35adae1ccab11c48577c6970df8 Mon Sep 17 00:00:00 2001 From: wqz <1197460504@qq.com> Date: Sun, 23 Apr 2023 16:33:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0if-else=20=EF=BC=8Cwhile?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/if_else.sy | 16 ++++++++++++++++ test/while.sy | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/if_else.sy create mode 100644 test/while.sy diff --git a/test/if_else.sy b/test/if_else.sy new file mode 100644 index 0000000..2b7efa2 --- /dev/null +++ b/test/if_else.sy @@ -0,0 +1,16 @@ +//test add + +int mul(int x, int y) { + return x * y; +} + +int main(){ + int a, b; + a = 10; + b = 0; + if(a>0) + a = mul(a, b); + else + b = mul(a, b);S + return a + b; +} diff --git a/test/while.sy b/test/while.sy new file mode 100644 index 0000000..c8a61ee --- /dev/null +++ b/test/while.sy @@ -0,0 +1,17 @@ +//test add + +int mul(int x, int y) { + return x * y; +} + +int main(){ + int a, b; + a = 10; + b = 0; + a = mul(a, b); + while(a) + { + a=a+1; + } + return a + b; +}