switch to own Docker image + updates to main.c
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
* use pre-built docker-archlinux-cdev - no need to `pacman` the way Signed-off-by: surtur <a_mirre@utb.cz>
This commit is contained in:
parent
4420a92cb5
commit
27ca02bda9
@ -8,9 +8,8 @@ platform:
|
||||
steps:
|
||||
- name: test build + valgrind
|
||||
pull: if-not-exists
|
||||
image: archlinux
|
||||
image: immawanderer/docker-archlinux-cdev
|
||||
commands:
|
||||
- pacman -Sy --noconfirm cmake make gcc valgrind
|
||||
- cmake CMakeLists.txt
|
||||
- make
|
||||
- valgrind --log-file=valgrind_output ./pjc-0x02 < ./test_input > output
|
||||
|
16
main.c
16
main.c
@ -46,12 +46,18 @@ int get_userguess(){
|
||||
return x;
|
||||
}
|
||||
|
||||
int compare_guess_with_reality(int userguess, int reality){
|
||||
void compare_guess_with_reality(int userguess, int reality){
|
||||
printf("[*] guess was: %d\n", userguess);
|
||||
printf("[*] reality is: %d\n", reality);
|
||||
|
||||
if (userguess == reality) return 0;
|
||||
else return 1;
|
||||
if(userguess == reality){
|
||||
printf("[*] you won because you've got luck. try me next time!\n");
|
||||
}else if(userguess < reality){
|
||||
printf("[*] you lost!\n");
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void guess(){
|
||||
@ -89,13 +95,11 @@ void guess(){
|
||||
printf("\tmy guess: ");
|
||||
|
||||
userguess = get_userguess();
|
||||
verdict = compare_guess_with_reality(userguess, nurand);
|
||||
compare_guess_with_reality(userguess, nurand);
|
||||
|
||||
if (verdict == 0){
|
||||
printf("[*] you won because you've got luck. try me next time!\n");
|
||||
}
|
||||
else {
|
||||
printf("[*] you lost!\n");
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user