Skip to content

Commit b3ea198

Browse files
committed
annotations for lab02
1 parent 1dcca96 commit b3ea198

File tree

670 files changed

+12897
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

670 files changed

+12897
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
int a,b,c;
6+
7+
scanf("%d%d%d",&a,&b,&c);
8+
if (a>=b && a >= c){
9+
printf("%d\n",a);
10+
}
11+
12+
if ( b >= a && b >= c){
13+
printf("%d\n",b);
14+
}
15+
16+
if (c >= b && c >= a){
17+
printf("%d\n",c);
18+
}
19+
return 0;
20+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_003
2+
- submission: sub_001
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_003-sub_002)
6+
- number_of_variables: 3
7+
- program_features: [no-else-statements]
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
11+
- number_of_faults: 1
12+
- faults: ['printf("Introduza 3 números inteiros\n");']
13+
- faulty_lines: [6]
14+
- fault_types: [Incorrect Output]
15+
- repair_actions: [Remove]
16+
- suggested_repairs: ['']
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
int i, n, maior;
6+
scanf("%d", &maior);
7+
for(i = 0; i < 2; i++)
8+
{
9+
scanf("%d", &n);
10+
maior = n > maior ? n : maior;
11+
}
12+
printf("%d\n", maior);
13+
return 0;
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_005
2+
- submission: sub_002
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_005-sub_001)
6+
- number_of_variables: 3
7+
- program_features: [scanf_ret_value, for_loop]
8+
- number_of_passed_tests: 2
9+
- number_of_failed_tests: 1
10+
- tests_output: [ex01_0: Accepted,ex01_1: Wrong Answer,ex01_2: Accepted]
11+
- number_of_faults: 1
12+
- faults: [' maior = scanf("%d", &n);']
13+
- faulty_lines: [5]
14+
- fault_types: [Wrong Initialization]
15+
- repair_actions: [Replace]
16+
- suggested_repairs: ['maior; scanf("%d", &maior);']
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include <stdio.h>
2+
3+
4+
5+
#define SIZE 3
6+
7+
8+
int maior(int a, int b, int c);
9+
10+
11+
int main()
12+
{
13+
int vetor[SIZE], i;
14+
for (i = 0; i < 3; ++i)
15+
{
16+
scanf("%d", &vetor[i]);
17+
}
18+
19+
return maior(vetor[0], vetor[1], vetor[2]);
20+
}
21+
22+
23+
int maior(int a, int b, int c)
24+
{
25+
int larger = a;
26+
if (larger < b)
27+
larger = b;
28+
if (larger < c)
29+
larger = c;
30+
31+
printf("%d\n", larger);
32+
return 0;
33+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_007
2+
- submission: sub_001
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_007-sub_004)
6+
- number_of_variables: 6
7+
- program_features: [for_loop,auxialiary_function,define,pointers]
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Presentation Error,ex01_1: Presentation Error,ex01_2: Presentation Error]
11+
- number_of_faults: 1
12+
- faults: [' printf("%d", larger);']
13+
- faulty_lines: [31]
14+
- fault_types: [Incorrect Output]
15+
- repair_actions: [Replace]
16+
- suggested_repairs: [' printf("%d\n", larger);']
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <stdio.h>
2+
3+
4+
5+
6+
7+
8+
int maior(int a, int b, int c);
9+
10+
11+
int main()
12+
{
13+
int vetor[3], i;
14+
for (i = 0; i < 3; ++i)
15+
{
16+
scanf("%d", &vetor[i]);
17+
}
18+
19+
printf("%d\n", maior(vetor[0], vetor[1], vetor[2]));
20+
21+
return 0;
22+
}
23+
24+
25+
int maior(int a, int b, int c)
26+
{
27+
int larger = a;
28+
if (larger < b)
29+
larger = b;
30+
if (larger < c)
31+
larger = c;
32+
33+
return larger;
34+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_007
2+
- submission: sub_002
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_007-sub_004)
6+
- number_of_variables: 5
7+
- program_features: [wrong_exercise]
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
11+
- number_of_faults: -1
12+
- faults: [ALL]
13+
- faulty_lines: [ALL]
14+
- fault_types: [Wrong Exercise]
15+
- repair_actions: [Remove]
16+
- suggested_repairs: ['']
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <stdio.h>
2+
3+
4+
5+
#define SIZE 3
6+
7+
8+
int maior(int a, int b, int c);
9+
10+
11+
int main()
12+
{
13+
int vetor[SIZE], i;
14+
for (i = 0; i < 3; ++i)
15+
{
16+
scanf("%d", &vetor[i]);
17+
}
18+
19+
printf("%d\n", maior(vetor[0], vetor[1], vetor[2]));
20+
21+
return 0;
22+
}
23+
24+
25+
int maior(int a, int b, int c)
26+
{
27+
int larger = a;
28+
if (larger < b)
29+
larger = b;
30+
if (larger < c)
31+
larger = c;
32+
33+
return larger;
34+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_007
2+
- submission: sub_003
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_007-sub_004)
6+
- number_of_variables: 6
7+
- program_features: [for_loop,auxiliary_function,define,pointers]
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
11+
- number_of_faults: 3
12+
- faults: ['printf("%d", maior(vetor[0], vetor[1], vetor[2]));', 'printf("%d\n", larger);', 'return 0;']
13+
- faulty_lines: [19, 33, 34]
14+
- fault_types: [Presentation Error,Incorrect Output,Wrong Instruction]
15+
- repair_actions: [Replace, Remove, Replace]
16+
- suggested_repairs: ['printf("%d\n", maior(vetor[0], vetor[1], vetor[2]));', '', 'return larger;']
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdio.h>
2+
3+
#define INFERIOR 1
4+
#define SUPERIOR 3
5+
#define PASSO 1
6+
7+
int main()
8+
{
9+
int maior;
10+
int input;
11+
int contador;
12+
13+
for (contador = INFERIOR; contador <= SUPERIOR; contador += PASSO)
14+
{
15+
scanf("%d", &input);
16+
if (contador == 1 || maior < input) {
17+
maior = input;
18+
}
19+
}
20+
printf("%d\n", maior);
21+
return 0;
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_009
2+
- submission: sub_001
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_009-sub_002)
6+
- number_of_variables: 3
7+
- program_features: [for-loop,define]
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
11+
- number_of_faults: 1
12+
- faults: [' printf("Maior: %d\n", maior);']
13+
- faulty_lines: [20]
14+
- fault_types: [Incorrect Output]
15+
- repair_actions: [Replace]
16+
- suggested_repairs: [' printf("%d\n", maior);']
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <stdio.h>
2+
3+
4+
5+
int main() {
6+
int x;
7+
int y;
8+
9+
scanf("%d", &x);
10+
11+
scanf("%d", &y);
12+
if (y > x) {
13+
x = y;
14+
}
15+
16+
scanf("%d", &y);
17+
if (y > x) {
18+
x = y;
19+
}
20+
printf("%d\n", x);
21+
return 0;
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_012
2+
- submission: sub_002
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_012-sub_001)
6+
- number_of_variables: 4
7+
- program_features: [wrong_exercise]
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
11+
- number_of_faults: -1
12+
- faults: [ALL]
13+
- faulty_lines: [ALL]
14+
- fault_types: [Wrong Exercise]
15+
- repair_actions: [Remove]
16+
- suggested_repairs: ['']
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
int n,i,z;
6+
scanf("%d",&n);
7+
scanf("%d\n",&i);
8+
scanf("%d\n",&z);
9+
if (n>i && n>z)
10+
printf("%d\n",n);
11+
else if (i>z)
12+
printf("%d\n",i);
13+
else
14+
printf("%d\n",z);
15+
return 0;
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_013
2+
- submission: sub_002
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_013-sub_001)
6+
- number_of_variables: 3
7+
- program_features: [insert-else]
8+
- number_of_passed_tests: 2
9+
- number_of_failed_tests: 1
10+
- tests_output: [ex01_0: Accepted,ex01_1: Wrong Answer,ex01_2: Accepted]
11+
- number_of_faults: 1
12+
- faults: [' if (i>z)']
13+
- faulty_lines: [11]
14+
- fault_types: [Wrong Instruction]
15+
- repair_actions: [Insert]
16+
- suggested_repairs: [' else if (i>z)']
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
5+
int n1, n2, n3;
6+
7+
8+
scanf("%d %d %d", &n1, &n2, &n3);
9+
10+
if ((n1 > n2) && (n1 > n3)) {
11+
printf("%d\n", n1);}
12+
13+
else if ((n2 > n1) && (n2 > n3)) {
14+
printf("%d\n", n2);}
15+
16+
else {
17+
printf("%d\n", n3);};
18+
19+
return 0;
20+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
- stu_id: stu_014
2+
- submission: sub_001
3+
- exercise: lab02/ex01
4+
- year: year-1
5+
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_014-sub_004)
6+
- number_of_variables: 3
7+
- program_features: []
8+
- number_of_passed_tests: 0
9+
- number_of_failed_tests: 3
10+
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
11+
- number_of_faults: 1
12+
- faults: [' printf("Insira 3 numeros:\n");']
13+
- faulty_lines: [7]
14+
- fault_types: [Incorrect Output]
15+
- repair_actions: [Remove]
16+
- suggested_repairs: ['']
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <stdio.h>
2+
3+
int main() {
4+
5+
int n1, n2, n3;
6+
7+
scanf("%d %d %d", &n1, &n2, &n3);
8+
9+
if ((n1 > n2) & (n1 > n3)) {
10+
printf("%d\n", n1);}
11+
12+
else if ((n2 > n1) & (n2 > n3)) {
13+
printf("%d\n", n2);}
14+
15+
else {
16+
printf("%d\n", n3);};
17+
18+
return 0;
19+
}

0 commit comments

Comments
 (0)