- Testreports
- HW2: Häufige Fehler
- Schleifen und Abfragen
- HW3: Besprechung
6a7, 1,6c1,6, 6d5?diff).a (append), d (delete) und c (change)
CHANCE #1
description:
check whether output is correct
summary:
[FAILED] comparing "$STDOUT"
compares:
< REFERENCE
> USER CREATED
#0: 6d5
6a7: Nach der 6. Zeile der Musterausgabe, müsste die folgende 7. Zeile angehängt werden (Zeile folgt). Das heißt, ihr gebt dieses Zeile zuviel aus6d5: Die 6. Zeile der Musterausgabe (Zeile folgt) müsste gelöscht werden. Das heißt, ihr gebt eine Zeile nicht aus, obwohl ihr solltet2c2: Die 2. Zeile der Musterausgabe stimmt nicht mit eurer 2. Zeile überein, daraufhin folgt die Zeile der Musterausgabe und eure Zeile
=====================================================================================
TESTCASES
testcase #1 [FAILED]
there were 1 chance(s) to pass testcase
CHANCE #1
description:
check whether output is correct
summary:
[FAILED] return check - ref: 0 user: 255
compares:
< REFERENCE
> USER CREATED
-------------------------------------------------------------------------------------
=====================================================================================
=====================================================================================
TESTCASES
testcase #1 [FAILED]
there were 1 chance(s) to pass testcase
CHANCE #1
description:
check whether output is correct
summary:
[FAILED] comparing "$STDOUT"
compares:
< REFERENCE
> USER CREATED
#0: 6a7
#0: > 1915657434 * 8
-------------------------------------------------------------------------------------
=====================================================================================
OUTPUT
Archive: Term_6/Course_11/Assignment_58/Group_7642/Submission_1_hw2.zip
inflating: Course_11/Assignment_58/Group_7642/14960/1381852533/hw2/hw2.c
Returnvalue was: 0 - should be 0
=====================================================================================
CHECK
check #1
Result:
[FAILED] File hw2.c not found
=====================================================================================
COMPILE
executable #1
using file_set #1
return was: 1 - should be 0
OUTPUT
gcc44: hw2.c: No such file or directory
gcc44: no input files
summary:
[FAILED] comparing "$STDOUT"
compares:
< REFERENCE
> USER CREATED
#0: 1,7c1,7
#0: < xxxxxxx * 2
#0: < xxxxxxx * 3
#0: < xxxxxxx * 4
#0: < xxxxxxxx * 5
#0: < xxxxxxxxx * 6
#0: < xxxxxxxxx * 7
#0: < An overflow has occurred!
#0: ---
#0: > xxxxxxx * 2
#0: > xxxxxxx * 3
#0: > xxxxxxx * 4
#0: > xxxxxxxx * 5
#0: > xxxxxxxxx * 6
#0: > xxxxxxxxx * 7
#0: > An overflow has occured!
summary:
[FAILED] comparing "$STDOUT"
compares:
< REFERENCE
> USER CREATED
#0: 1,6c1,6
#0: < xxxxxxx * 2
#0: < xxxxxxx * 3
#0: < xxxxxxx * 4
#0: < xxxxxxxx * 5
#0: < xxxxxxxxx * 6
#0: < xxxxxxxxx * 7
#0: ---
#0: > xxxxxxx * 2
#0: > xxxxxxx * 3
#0: > xxxxxxx * 4
#0: > xxxxxxxx * 5
#0: > xxxxxxxxx * 6
#0: > xxxxxxxxx * 7
i, tmp, ...)Code wird nur dann ausgeführt wenn eine bestimmte Bedingung erfüllt ist.
if(bedingung)
{
// wird ausgeführt wenn die Bedingung erüllt ist
}
else
{
// wird ausgeführt wenn die Bedingung nicht erfüllt ist
}
Als Bedingung wird meistens ein Vergleich verwendet (z.B. age > 18)
|
1int main()
{
2 int age = 17;
3 if(age >= 18)
{
printf("Willkommen im Casino!");
}
4 else
{
5 printf("Zutritt verweigert!");
}
6 return 0;
}
|
|
for, while, do (if ist keine Schleife!)
#include <stdio.h>
int main()
{
int beer = 99;
while(beer > 0)
{
printf("%d bottles of beer on the wall, %d bottles of beer.\n", beer, beer);
beer = beer - 1;
printf("Take one down and pass it around, %d bottles of beer on the wall.\n", beer);
}
printf("No more bottles of beer on the wall, no more bottles of beer.\n");
return 0;
}
/* For-Loop example */
#include <stdio.h>
int main()
{
int number_of_students = 20;
int student_id = 0;
//Init, Condition
for (student_id = 0; student_id < number_of_students; student_id++)
{
printf("Student-ID: %d\n", student_id);
//Step
}
return 0;
}
/* While-Loop example */
#include <stdio.h>
int main()
{
int number_of_students = 20;
int student_id = 0; //Init
while(student_id < number_of_students) //Condition
{
printf("Student-ID: %d\n", student_id);
student_id++; //Step
}
return 0;
}
/* While-Loop example 2 */
#include <stdio.h>
int main()
{
int max_value = 100;
int current_value = 1;
int add_value = 2;
int iterations = 0; //Init
while(current_value < max_value) //Condition
{
current_value += add_value;
iterations++; //Step
}
printf("Iterations: %d\n", iterations);
return 0;
}
Abgabeschluss: