Skip to content

Commit

Permalink
annotations for lab02
Browse files Browse the repository at this point in the history
  • Loading branch information
pmorvalho committed Apr 20, 2024
1 parent 1dcca96 commit b3ea198
Show file tree
Hide file tree
Showing 670 changed files with 12,897 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>

int main()
{
int a,b,c;

scanf("%d%d%d",&a,&b,&c);
if (a>=b && a >= c){
printf("%d\n",a);
}

if ( b >= a && b >= c){
printf("%d\n",b);
}

if (c >= b && c >= a){
printf("%d\n",c);
}
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_003
- submission: sub_001
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_003-sub_002)
- number_of_variables: 3
- program_features: [no-else-statements]
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
- number_of_faults: 1
- faults: ['printf("Introduza 3 números inteiros\n");']
- faulty_lines: [6]
- fault_types: [Incorrect Output]
- repair_actions: [Remove]
- suggested_repairs: ['']
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>

int main()
{
int i, n, maior;
scanf("%d", &maior);
for(i = 0; i < 2; i++)
{
scanf("%d", &n);
maior = n > maior ? n : maior;
}
printf("%d\n", maior);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_005
- submission: sub_002
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_005-sub_001)
- number_of_variables: 3
- program_features: [scanf_ret_value, for_loop]
- number_of_passed_tests: 2
- number_of_failed_tests: 1
- tests_output: [ex01_0: Accepted,ex01_1: Wrong Answer,ex01_2: Accepted]
- number_of_faults: 1
- faults: [' maior = scanf("%d", &n);']
- faulty_lines: [5]
- fault_types: [Wrong Initialization]
- repair_actions: [Replace]
- suggested_repairs: ['maior; scanf("%d", &maior);']
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <stdio.h>



#define SIZE 3


int maior(int a, int b, int c);


int main()
{
int vetor[SIZE], i;
for (i = 0; i < 3; ++i)
{
scanf("%d", &vetor[i]);
}

return maior(vetor[0], vetor[1], vetor[2]);
}


int maior(int a, int b, int c)
{
int larger = a;
if (larger < b)
larger = b;
if (larger < c)
larger = c;

printf("%d\n", larger);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_007
- submission: sub_001
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_007-sub_004)
- number_of_variables: 6
- program_features: [for_loop,auxialiary_function,define,pointers]
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Presentation Error,ex01_1: Presentation Error,ex01_2: Presentation Error]
- number_of_faults: 1
- faults: [' printf("%d", larger);']
- faulty_lines: [31]
- fault_types: [Incorrect Output]
- repair_actions: [Replace]
- suggested_repairs: [' printf("%d\n", larger);']
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <stdio.h>






int maior(int a, int b, int c);


int main()
{
int vetor[3], i;
for (i = 0; i < 3; ++i)
{
scanf("%d", &vetor[i]);
}

printf("%d\n", maior(vetor[0], vetor[1], vetor[2]));

return 0;
}


int maior(int a, int b, int c)
{
int larger = a;
if (larger < b)
larger = b;
if (larger < c)
larger = c;

return larger;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_007
- submission: sub_002
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_007-sub_004)
- number_of_variables: 5
- program_features: [wrong_exercise]
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
- number_of_faults: -1
- faults: [ALL]
- faulty_lines: [ALL]
- fault_types: [Wrong Exercise]
- repair_actions: [Remove]
- suggested_repairs: ['']
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <stdio.h>



#define SIZE 3


int maior(int a, int b, int c);


int main()
{
int vetor[SIZE], i;
for (i = 0; i < 3; ++i)
{
scanf("%d", &vetor[i]);
}

printf("%d\n", maior(vetor[0], vetor[1], vetor[2]));

return 0;
}


int maior(int a, int b, int c)
{
int larger = a;
if (larger < b)
larger = b;
if (larger < c)
larger = c;

return larger;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_007
- submission: sub_003
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_007-sub_004)
- number_of_variables: 6
- program_features: [for_loop,auxiliary_function,define,pointers]
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
- number_of_faults: 3
- faults: ['printf("%d", maior(vetor[0], vetor[1], vetor[2]));', 'printf("%d\n", larger);', 'return 0;']
- faulty_lines: [19, 33, 34]
- fault_types: [Presentation Error,Incorrect Output,Wrong Instruction]
- repair_actions: [Replace, Remove, Replace]
- suggested_repairs: ['printf("%d\n", maior(vetor[0], vetor[1], vetor[2]));', '', 'return larger;']
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <stdio.h>

#define INFERIOR 1
#define SUPERIOR 3
#define PASSO 1

int main()
{
int maior;
int input;
int contador;

for (contador = INFERIOR; contador <= SUPERIOR; contador += PASSO)
{
scanf("%d", &input);
if (contador == 1 || maior < input) {
maior = input;
}
}
printf("%d\n", maior);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_009
- submission: sub_001
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_009-sub_002)
- number_of_variables: 3
- program_features: [for-loop,define]
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
- number_of_faults: 1
- faults: [' printf("Maior: %d\n", maior);']
- faulty_lines: [20]
- fault_types: [Incorrect Output]
- repair_actions: [Replace]
- suggested_repairs: [' printf("%d\n", maior);']
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <stdio.h>



int main() {
int x;
int y;

scanf("%d", &x);

scanf("%d", &y);
if (y > x) {
x = y;
}

scanf("%d", &y);
if (y > x) {
x = y;
}
printf("%d\n", x);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_012
- submission: sub_002
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_012-sub_001)
- number_of_variables: 4
- program_features: [wrong_exercise]
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
- number_of_faults: -1
- faults: [ALL]
- faulty_lines: [ALL]
- fault_types: [Wrong Exercise]
- repair_actions: [Remove]
- suggested_repairs: ['']
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>

int main()
{
int n,i,z;
scanf("%d",&n);
scanf("%d\n",&i);
scanf("%d\n",&z);
if (n>i && n>z)
printf("%d\n",n);
else if (i>z)
printf("%d\n",i);
else
printf("%d\n",z);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_013
- submission: sub_002
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_013-sub_001)
- number_of_variables: 3
- program_features: [insert-else]
- number_of_passed_tests: 2
- number_of_failed_tests: 1
- tests_output: [ex01_0: Accepted,ex01_1: Wrong Answer,ex01_2: Accepted]
- number_of_faults: 1
- faults: [' if (i>z)']
- faulty_lines: [11]
- fault_types: [Wrong Instruction]
- repair_actions: [Insert]
- suggested_repairs: [' else if (i>z)']
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>

int main() {

int n1, n2, n3;


scanf("%d %d %d", &n1, &n2, &n3);

if ((n1 > n2) && (n1 > n3)) {
printf("%d\n", n1);}

else if ((n2 > n1) && (n2 > n3)) {
printf("%d\n", n2);}

else {
printf("%d\n", n3);};

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- stu_id: stu_014
- submission: sub_001
- exercise: lab02/ex01
- year: year-1
- correct_submission: [path](https://github.com/pmorvalho/C-Pack-IPAs/blob/main/correct_submissions/year-1/lab02/ex01/ex01-stu_014-sub_004)
- number_of_variables: 3
- program_features: []
- number_of_passed_tests: 0
- number_of_failed_tests: 3
- tests_output: [ex01_0: Wrong Answer,ex01_1: Wrong Answer,ex01_2: Wrong Answer]
- number_of_faults: 1
- faults: [' printf("Insira 3 numeros:\n");']
- faulty_lines: [7]
- fault_types: [Incorrect Output]
- repair_actions: [Remove]
- suggested_repairs: ['']
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>

int main() {

int n1, n2, n3;

scanf("%d %d %d", &n1, &n2, &n3);

if ((n1 > n2) & (n1 > n3)) {
printf("%d\n", n1);}

else if ((n2 > n1) & (n2 > n3)) {
printf("%d\n", n2);}

else {
printf("%d\n", n3);};

return 0;
}
Loading

0 comments on commit b3ea198

Please sign in to comment.