commit 058820ec38238817fc48fded553cdfe141ceab9b Author: yas <3332538009@qq.com> Date: Mon Jul 22 04:59:39 2024 +0000 check diff --git a/00.sy b/00.sy new file mode 100644 index 0000000..b26df97 --- /dev/null +++ b/00.sy @@ -0,0 +1,16 @@ +int gcd(int a, int b) { + if (a == b){ return a; } + else if (a > b) { return gcd(a - b, b); } + else return gcd(b - a, a); +} + +const int LF = 10; + +int main(){ + int a,b; + a = getint(); + b = getint(); + putint(gcd(a,b)); + putch(LF); + return 0; +} diff --git a/01.sy b/01.sy new file mode 100644 index 0000000..f7cd89d --- /dev/null +++ b/01.sy @@ -0,0 +1,12 @@ +float LF = 1; +const int LF = 10; + +int main(){ + int a,b; + a = getint(); + b = getint(); + putint(gcd(a,b)); + putch(LF); + return 0; +} +// Redefined Variable 重复定义变量/重复声明 \ No newline at end of file diff --git a/02.sy b/02.sy new file mode 100644 index 0000000..7286776 --- /dev/null +++ b/02.sy @@ -0,0 +1,17 @@ +int gcd(int a, int a) { + if (a == b){ return a; } + else if (a > b) { return gcd(a - b, b); } + else return gcd(b - a, a); +} + +const int LF = 10; + +int main(){ + int a,b; + a = getint(); + b = getint(); + putint(gcd(a,b)); + putch(LF); + return 0; +} +// Redefined Variable 函数形参重复定义 \ No newline at end of file diff --git a/03.sy b/03.sy new file mode 100644 index 0000000..cdd4536 --- /dev/null +++ b/03.sy @@ -0,0 +1,17 @@ +int gcd(int a, int b) { + if (a == b){ return a; } + else if (a > b) { return gcd(a - b, b); } + else return gcd(b - a, a); +} +void gcd(int a) { + return ; +} +int main(){ + int a,b; + a = getint(); + b = getint(); + putint(gcd(a,b)); + putch(LF); + return 0; +} +// Redefined Function 函数重复定义 \ No newline at end of file diff --git a/04.sy b/04.sy new file mode 100644 index 0000000..a2ad990 --- /dev/null +++ b/04.sy @@ -0,0 +1,9 @@ +int main(){ + int b; + a = getint(); + b = getint(); + putint(gcd(a,b)); + putch(LF); + return 0; +} +// Use Undefined Variable 使用未定义变量 \ No newline at end of file diff --git a/05.sy b/05.sy new file mode 100644 index 0000000..93fc715 --- /dev/null +++ b/05.sy @@ -0,0 +1,8 @@ +int main(){ + int a = 0,b = 0; + a = test(); + b = getint(); + test(a,b); + return 0; +} +// Use Undefined Function 使用未定义函数 diff --git a/06.sy b/06.sy new file mode 100644 index 0000000..1056d8d --- /dev/null +++ b/06.sy @@ -0,0 +1,14 @@ +int gcd(int a, int b) { + return 1; +} +int main(){ + int a,b; + a = getint(); + b = getint(); + gcd(gcd(),gcd()); + putint(gcd(a)); + putch(LF); + return 0; +} +// Redefined Function 函数重复定义 +// 不要出现这样的形式putint(gcd(a)),putint是系统自带函数没有处理?(因为没有进行处理 \ No newline at end of file diff --git a/07.sy b/07.sy new file mode 100644 index 0000000..401eecd --- /dev/null +++ b/07.sy @@ -0,0 +1,11 @@ +float test(int a, int b) { + if (a+b==1){ + return a+b; + } + return 0.1; +} +int main() { + float c = test(1,1); + return 0; +} +// Func Return Type Not Match 返回类型不匹配 diff --git a/08.sy b/08.sy new file mode 100644 index 0000000..ab807e7 --- /dev/null +++ b/08.sy @@ -0,0 +1,11 @@ +int test(int a, int b) { + int d[1][2]; + int c[10]; + c[0.1] = 0; + return 1; +} +int main() { + int c = test(1,1); + return 0; +} +// Array index not int 数组下标不是整数 diff --git a/09.sy b/09.sy new file mode 100644 index 0000000..5e7370e --- /dev/null +++ b/09.sy @@ -0,0 +1,18 @@ +int test(int a, int b) { + int i = 0; + while (i <= 10) { + i = i + 1; + if ( i == 3 ) { + break; + } + } + + return 1; +} +int main() { + int c = test(1,1); + continue; + return 0; +} +// Break not in loop break语句不在循环中 + diff --git a/10.sy b/10.sy new file mode 100644 index 0000000..6ddc6e1 --- /dev/null +++ b/10.sy @@ -0,0 +1,18 @@ +int test(int a, int b) { + int i = 0; + while (i <= 10) { + i = i + 1; + + } + if ( i == 11 ) { + break; + } + return 1; +} +int main() { + int c = test(1,1); + continue; + return 0; +} +// Continue not in loop break语句不在循环中 + diff --git a/11.sy b/11.sy new file mode 100644 index 0000000..e9e46e6 --- /dev/null +++ b/11.sy @@ -0,0 +1,12 @@ +int test(int a, int b) { + + int c ; + c[10] = a + b; +} +int main() { + int c = test(1,1); + return 0; +} +// Visit non-array variable in the form of subscript variables 对非数组变量采用下标变量的形式访问 + + diff --git a/14.sy b/14.sy new file mode 100644 index 0000000..608c4bd --- /dev/null +++ b/14.sy @@ -0,0 +1,18 @@ +int main(){ + int i = 1; + while (i < 9) { + int j = 1; + while (j < 0) { + int a = i * j * b; + c = a; + j = j + 1; + //if (j == 5) break; + } + d = j; + if (i == 5) break; + i = i + 1; + } + i = e * 5; + + return 0; +} \ No newline at end of file diff --git a/20.sy b/20.sy new file mode 100644 index 0000000..3e4b832 --- /dev/null +++ b/20.sy @@ -0,0 +1,11 @@ +int main(){ + int a,b; + + a = 0; + while (a < 10) { + c = c + a; + a = a + 1; + } + + return 0; +} \ No newline at end of file