Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Administrator
Public Cpp Test
Commits
2a291a73
Commit
2a291a73
authored
Oct 23, 2023
by
shengnan hu
Browse files
main
parents
Changes
638
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
420 additions
and
0 deletions
+420
-0
BM-GJB8114-2013/R-1-2-3/R-1-2-3-bad.cpp
BM-GJB8114-2013/R-1-2-3/R-1-2-3-bad.cpp
+12
-0
BM-GJB8114-2013/R-1-2-3/R-1-2-3-good.c
BM-GJB8114-2013/R-1-2-3/R-1-2-3-good.c
+12
-0
BM-GJB8114-2013/R-1-2-3/R-1-2-3-good.cpp
BM-GJB8114-2013/R-1-2-3/R-1-2-3-good.cpp
+12
-0
BM-GJB8114-2013/R-1-2-4/R-1-2-4-bad.c
BM-GJB8114-2013/R-1-2-4/R-1-2-4-bad.c
+18
-0
BM-GJB8114-2013/R-1-2-4/R-1-2-4-bad.cpp
BM-GJB8114-2013/R-1-2-4/R-1-2-4-bad.cpp
+18
-0
BM-GJB8114-2013/R-1-2-4/R-1-2-4-good.c
BM-GJB8114-2013/R-1-2-4/R-1-2-4-good.c
+18
-0
BM-GJB8114-2013/R-1-2-4/R-1-2-4-good.cpp
BM-GJB8114-2013/R-1-2-4/R-1-2-4-good.cpp
+18
-0
BM-GJB8114-2013/R-1-2-5/R-1-2-5-bad.c
BM-GJB8114-2013/R-1-2-5/R-1-2-5-bad.c
+17
-0
BM-GJB8114-2013/R-1-2-5/R-1-2-5-bad.cpp
BM-GJB8114-2013/R-1-2-5/R-1-2-5-bad.cpp
+17
-0
BM-GJB8114-2013/R-1-2-5/R-1-2-5-good.c
BM-GJB8114-2013/R-1-2-5/R-1-2-5-good.c
+17
-0
BM-GJB8114-2013/R-1-2-5/R-1-2-5-good.cpp
BM-GJB8114-2013/R-1-2-5/R-1-2-5-good.cpp
+17
-0
BM-GJB8114-2013/R-1-2-6/R-1-2-6-bad.c
BM-GJB8114-2013/R-1-2-6/R-1-2-6-bad.c
+13
-0
BM-GJB8114-2013/R-1-2-6/R-1-2-6-bad.cpp
BM-GJB8114-2013/R-1-2-6/R-1-2-6-bad.cpp
+13
-0
BM-GJB8114-2013/R-1-3-1/R-1-3-1-bad.c
BM-GJB8114-2013/R-1-3-1/R-1-3-1-bad.c
+21
-0
BM-GJB8114-2013/R-1-3-1/R-1-3-1-bad.cpp
BM-GJB8114-2013/R-1-3-1/R-1-3-1-bad.cpp
+21
-0
BM-GJB8114-2013/R-1-3-10/R-1-3-10-bad.c
BM-GJB8114-2013/R-1-3-10/R-1-3-10-bad.c
+37
-0
BM-GJB8114-2013/R-1-3-10/R-1-3-10-bad.cpp
BM-GJB8114-2013/R-1-3-10/R-1-3-10-bad.cpp
+37
-0
BM-GJB8114-2013/R-1-3-10/R-1-3-10-good.c
BM-GJB8114-2013/R-1-3-10/R-1-3-10-good.c
+38
-0
BM-GJB8114-2013/R-1-3-10/R-1-3-10-good.cpp
BM-GJB8114-2013/R-1-3-10/R-1-3-10-good.cpp
+38
-0
BM-GJB8114-2013/R-1-3-2/R-1-3-2-bad.c
BM-GJB8114-2013/R-1-3-2/R-1-3-2-bad.c
+26
-0
No files found.
BM-GJB8114-2013/R-1-2-3/R-1-2-3-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
#include "..\061\061.h" //违背1
int
ix
=
0
;
int
iy
=
1
;
int
iz
=
2
;
idata
=
ix
+
iy
+
iz
;
return
(
0
);
}
BM-GJB8114-2013/R-1-2-3/R-1-2-3-good.c
0 → 100644
View file @
2a291a73
#include "..\061\061.h" //遵循1
int
main
(
void
)
{
int
ix
=
0
;
int
iy
=
1
;
int
iz
=
2
;
idata
=
ix
+
iy
+
iz
;
return
(
0
);
}
BM-GJB8114-2013/R-1-2-3/R-1-2-3-good.cpp
0 → 100644
View file @
2a291a73
#include "..\061\061.h" //遵循1
int
main
(
void
)
{
int
ix
=
0
;
int
iy
=
1
;
int
iz
=
2
;
idata
=
ix
+
iy
+
iz
;
return
(
0
);
}
BM-GJB8114-2013/R-1-2-4/R-1-2-4-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
,
j
=
1
,
k
=
2
;
int
a
=
0
,
b
=
0
;
//......
if
(
(
0
==
i
)
||
(
1
==
j
)
&&
(
2
==
k
)
)
//违背1
{
a
=
0
;
}
else
{
a
=
1
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-4/R-1-2-4-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
,
j
=
1
,
k
=
2
;
int
a
=
0
,
b
=
0
;
//......
if
(
(
0
==
i
)
||
(
1
==
j
)
&&
(
2
==
k
)
)
//违背1
{
a
=
0
;
}
else
{
a
=
1
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-4/R-1-2-4-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
,
j
=
1
,
k
=
2
;
int
a
=
0
,
b
=
0
;
//......
if
(
(
(
0
==
i
)
||
(
1
==
j
)
)
&&
(
2
==
k
)
)
//遵循1
{
a
=
0
;
}
else
{
a
=
1
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-4/R-1-2-4-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
,
j
=
1
,
k
=
2
;
int
a
=
0
,
b
=
0
;
//......
if
(
(
(
0
==
i
)
||
(
1
==
j
)
)
&&
(
2
==
k
)
)
//遵循1
{
a
=
0
;
}
else
{
a
=
1
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-5/R-1-2-5-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
i
,
tbc
;
tbc
=
0x80
;
if
(
tbc
&
0x80
==
0x80
)
//违背1
{
i
=
1
;
}
else
{
i
=
2
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-5/R-1-2-5-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
i
,
tbc
;
tbc
=
0x80
;
if
(
tbc
&
0x80
==
0x80
)
//违背1
{
i
=
1
;
}
else
{
i
=
2
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-5/R-1-2-5-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
i
,
tbc
;
tbc
=
0x80
;
if
(
(
tbc
&
0x80
)
==
0x80
)
//遵循1
{
i
=
1
;
}
else
{
i
=
2
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-5/R-1-2-5-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
i
,
tbc
;
tbc
=
0x80
;
if
(
(
tbc
&
0x80
)
==
0x80
)
//遵循1
{
i
=
1
;
}
else
{
i
=
2
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-2-6/R-1-2-6-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
local
=
0
;
int
sign
=
0
;
/*
note for code1
/* //违背1
note for code2
*/
return
(
0
);
}
BM-GJB8114-2013/R-1-2-6/R-1-2-6-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
local
=
0
;
int
sign
=
0
;
/*
note for code1
/* //违背1
note for code2
*/
return
(
0
);
}
BM-GJB8114-2013/R-1-3-1/R-1-3-1-bad.c
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
array
[
5
]
=
{
0
,
1
,
2
,
3
,
4
};
unsigned
int
*
p1_ptr
=
NULL
,
**
p2_ptr
=
NULL
;
unsigned
int
***
p3_ptr
=
NULL
;
//违背1
unsigned
int
data
[
5
];
unsigned
int
i
;
p1_ptr
=
array
;
p2_ptr
=
&
p1_ptr
;
p3_ptr
=
&
p2_ptr
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
data
[
i
]
=
*
(
**
p3_ptr
+
i
);
}
return
(
0
);
}
BM-GJB8114-2013/R-1-3-1/R-1-3-1-bad.cpp
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
array
[
5
]
=
{
0
,
1
,
2
,
3
,
4
};
unsigned
int
*
p1_ptr
=
NULL
,
**
p2_ptr
=
NULL
;
unsigned
int
***
p3_ptr
=
NULL
;
//违背1
unsigned
int
data
[
5
];
unsigned
int
i
;
p1_ptr
=
array
;
p2_ptr
=
&
p1_ptr
;
p3_ptr
=
&
p2_ptr
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
data
[
i
]
=
*
(
**
p3_ptr
+
i
);
}
return
(
0
);
}
BM-GJB8114-2013/R-1-3-10/R-1-3-10-bad.c
0 → 100644
View file @
2a291a73
#include <stdio.h>
int
fr
(
void
);
int
main
(
void
)
{
int
ret
;
ret
=
fr
(
);
//...
return
(
0
);
}
int
fr
(
void
)
{
FILE
*
stream
=
NULL
;
char
s
[
100
];
int
n
;
if
(
NULL
==
(
stream
=
fopen
(
"data"
,
"r"
)
)
)
{
printf
(
"The file 'data' was not opened
\n
"
);
return
(
-
1
);
}
else
{
printf
(
"The file 'data' was opened
\n
"
);
n
=
fscanf
(
stream
,
"%s"
,
s
);
//...
return
(
0
);
//违背1
}
}
BM-GJB8114-2013/R-1-3-10/R-1-3-10-bad.cpp
0 → 100644
View file @
2a291a73
#include <stdio.h>
int
fr
(
void
);
int
main
(
void
)
{
int
ret
;
ret
=
fr
(
);
//...
return
(
0
);
}
int
fr
(
void
)
{
FILE
*
stream
=
NULL
;
char
s
[
100
];
int
n
;
if
(
NULL
==
(
stream
=
fopen
(
"data"
,
"r"
)
)
)
{
printf
(
"The file 'data' was not opened
\n
"
);
return
(
-
1
);
}
else
{
printf
(
"The file 'data' was opened
\n
"
);
n
=
fscanf
(
stream
,
"%s"
,
s
);
//...
return
(
0
);
//违背1
}
}
BM-GJB8114-2013/R-1-3-10/R-1-3-10-good.c
0 → 100644
View file @
2a291a73
#include <stdio.h>
int
fr
(
void
);
int
main
(
void
)
{
int
ret
;
ret
=
fr
(
);
//...
return
(
0
);
}
int
fr
(
void
)
{
FILE
*
stream
=
NULL
;
char
s
[
100
];
int
n
;
if
(
NULL
==
(
stream
=
fopen
(
"data"
,
"r"
)
)
)
{
printf
(
"The file 'data' was not opened
\n
"
);
return
(
-
1
);
}
else
{
printf
(
"The file 'data' was opened
\n
"
);
n
=
fscanf
(
stream
,
"%s"
,
s
);
//...
fclose
(
stream
);
//遵循1
return
(
0
);
}
}
BM-GJB8114-2013/R-1-3-10/R-1-3-10-good.cpp
0 → 100644
View file @
2a291a73
#include <stdio.h>
int
fr
(
void
);
int
main
(
void
)
{
int
ret
;
ret
=
fr
(
);
//...
return
(
0
);
}
int
fr
(
void
)
{
FILE
*
stream
=
NULL
;
char
s
[
100
];
int
n
;
if
(
NULL
==
(
stream
=
fopen
(
"data"
,
"r"
)
)
)
{
printf
(
"The file 'data' was not opened
\n
"
);
return
(
-
1
);
}
else
{
printf
(
"The file 'data' was opened
\n
"
);
n
=
fscanf
(
stream
,
"%s"
,
s
);
//...
fclose
(
stream
);
//遵循1
return
(
0
);
}
}
BM-GJB8114-2013/R-1-3-2/R-1-3-2-bad.c
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
fun
(
int
para1
,
int
para2
);
int
main
(
void
)
{
int
a
=
2
,
b
=
1
,
c
=
0
;
if
(
NULL
==
fun
)
//违背1
{
return
-
1
;
}
else
{
int
(
*
p
)
(
int
,
int
)
=
fun
;
//违背2
c
=
p
(
a
,
b
);
}
return
(
0
);
}
int
fun
(
int
para1
,
int
para2
)
{
return
(
para1
-
para2
);
}
Prev
1
…
8
9
10
11
12
13
14
15
16
…
32
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment