updated .drone.yml + added some files + changes
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
* added bubblesort func * targeting latest cdev image now * a couple more changes (I know it's lame)
This commit is contained in:
parent
e9085017d3
commit
9917cd31f0
@ -8,7 +8,7 @@ platform:
|
|||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
pull: always
|
pull: always
|
||||||
image: immawanderer/archlinux-cdev
|
image: immawanderer/archlinux-cdev:latest
|
||||||
commands:
|
commands:
|
||||||
- cmake CMakeLists.txt
|
- cmake CMakeLists.txt
|
||||||
- make
|
- make
|
||||||
@ -44,7 +44,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: appleboy/drone-discord:1.2.4
|
image: appleboy/drone-discord:1.2.4
|
||||||
settings:
|
settings:
|
||||||
message: "{{#success build.status}} ✅ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.\nevent: **`{{build.event}}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`\n```{{commit.message}}``` {{else}} ❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.\nevent: **`${DRONE_BUILD_EVENT}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}} on `{{commit.branch}}`:\n``` {{commit.message}} ``` {{/success}}\n\n"
|
message: "{{#success build.status}} ✅ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.\nevent: **`{{build.event}}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`{{else}} ❌ [Build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.\nevent: **`${DRONE_BUILD_EVENT}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}} on `{{commit.branch}}`{{/success}}"
|
||||||
webhook_id:
|
webhook_id:
|
||||||
from_secret: discord_webhook_id
|
from_secret: discord_webhook_id
|
||||||
webhook_token:
|
webhook_token:
|
||||||
@ -80,7 +80,7 @@ steps:
|
|||||||
pull: always
|
pull: always
|
||||||
image: appleboy/drone-discord:1.2.4
|
image: appleboy/drone-discord:1.2.4
|
||||||
settings:
|
settings:
|
||||||
message: "{{#success build.status}} ✅ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.\nevent: **`{{build.event}}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}`\n```{{commit.message}}``` {{else}} ❌ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.\nevent: **`${DRONE_BUILD_EVENT}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}} on `{{commit.branch}}`:\n``` {{commit.message}} ``` {{/success}}\n\n"
|
message: "{{#success build.status}} ✅ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` succeeded.\nevent: **`{{build.event}}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}}` {{else}} ❌ [Hourly build #{{build.number}}]({{build.link}}) of `{{repo.name}}` failed.\nevent: **`${DRONE_BUILD_EVENT}`**\ncommit [`${DRONE_COMMIT_SHA:0:7}`](https://git.dotya.ml/${DRONE_REPO}/commit/${DRONE_COMMIT_SHA}) by {{commit.author}} on `{{commit.branch}} on `{{commit.branch}}`{{/success}}"
|
||||||
webhook_id:
|
webhook_id:
|
||||||
from_secret: discord_webhook_hourly_id
|
from_secret: discord_webhook_hourly_id
|
||||||
webhook_token:
|
webhook_token:
|
||||||
|
@ -2,4 +2,4 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
|
|
||||||
project(pjc-0x03 LANGUAGES C)
|
project(pjc-0x03 LANGUAGES C)
|
||||||
|
|
||||||
add_executable(pjc-0x03 main.c minmax.c minmax.h main.h)
|
add_executable(pjc-0x03 main.c minmax.c minmax.h main.h bubblesort.c bubblesort.h)
|
||||||
|
38
bubblesort.c
Normal file
38
bubblesort.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "bubblesort.h"
|
||||||
|
|
||||||
|
void bubblesort(int a[], int elems){
|
||||||
|
int a_length = sizeof(a)/sizeof(char);
|
||||||
|
int no_more_cycles = 0;
|
||||||
|
|
||||||
|
printf("[i] a_length = %d\n", a_length);
|
||||||
|
|
||||||
|
printf("[*] array [%d]:\n", a_length);
|
||||||
|
for (int j = 0; j < a_length; ++j) {
|
||||||
|
printf("%d ", a[j]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
while (no_more_cycles != a_length) {
|
||||||
|
no_more_cycles = 0;
|
||||||
|
for (int i = 0; i < a_length; ++i) {
|
||||||
|
if (a[i] > a[i+1]){
|
||||||
|
int tmp = a[i];
|
||||||
|
a[i] = a[i+1];
|
||||||
|
a[i+1] = tmp;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
no_more_cycles++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("[*] bubblesorted array [%d]:\n", a_length);
|
||||||
|
for (int i = 0; i < a_length; ++i) {
|
||||||
|
printf("%d ", a[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int return_bubblesorted(int a[]){
|
||||||
|
return 0;
|
||||||
|
}
|
10
bubblesort.h
Normal file
10
bubblesort.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef PJC_0X03_BUBBLESORT_H
|
||||||
|
#define PJC_0X03_BUBBLESORT_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void bubblesort(int a[], int elems);
|
||||||
|
|
||||||
|
int return_bubblesorted(int a[]);
|
||||||
|
|
||||||
|
#endif //PJC_0X03_BUBBLESORT_H
|
14
main.c
14
main.c
@ -2,6 +2,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "minmax.h"
|
#include "minmax.h"
|
||||||
|
#include "bubblesort.h"
|
||||||
|
|
||||||
int get_userguess(){
|
int get_userguess(){
|
||||||
int x = -1;
|
int x = -1;
|
||||||
@ -18,7 +19,8 @@ int get_userguess(){
|
|||||||
while (fgetc(stdin) != '\n'){
|
while (fgetc(stdin) != '\n'){
|
||||||
}
|
}
|
||||||
printf("[*] give me a correct value\n");
|
printf("[*] give me a correct value\n");
|
||||||
printf("[*] stop gibbering around\n my guess >>> ");
|
break;
|
||||||
|
// printf("[*] stop gibbering around\n my guess >>> ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
@ -31,14 +33,15 @@ int lemmego(){
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int selection, max, min = 0;
|
int selection, max, min;
|
||||||
|
int a[] = {1,2,3,5,4,0};
|
||||||
|
|
||||||
while ( selection != 8 ) {
|
while ( selection != 8 ) {
|
||||||
printf("\npick a choice\n");
|
printf("\npick a choice\n");
|
||||||
printf("1 - max\n"
|
printf("1 - max\n"
|
||||||
"2 - min\n"
|
"2 - min\n"
|
||||||
"3 - nothing..\n"
|
"3 - bubblesort\n"
|
||||||
"4 - here yet\n"
|
"4 - nothing here yet\n"
|
||||||
"8 - quit\n"
|
"8 - quit\n"
|
||||||
">> ");
|
">> ");
|
||||||
|
|
||||||
@ -54,6 +57,7 @@ int main()
|
|||||||
printf("minumum je %d\n", min);
|
printf("minumum je %d\n", min);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
bubblesort(a,6);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
break;
|
break;
|
||||||
@ -61,7 +65,7 @@ int main()
|
|||||||
lemmego();
|
lemmego();
|
||||||
return 9000;
|
return 9000;
|
||||||
default:
|
default:
|
||||||
printf("invalid option\n");
|
printf("[*] invalid option\n");
|
||||||
selection = 0;
|
selection = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
12
minmax.c
12
minmax.c
@ -5,8 +5,8 @@
|
|||||||
int maximum()
|
int maximum()
|
||||||
{
|
{
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
printf("Zadejte 3 cisla oddelena mezerou: ");
|
|
||||||
printf("** printmax **\n");
|
printf("** printmax **\n");
|
||||||
|
printf("Zadejte 3 cisla oddelena mezerou: ");
|
||||||
|
|
||||||
scanf("%d%d%d", &x, &y, &z);
|
scanf("%d%d%d", &x, &y, &z);
|
||||||
int max = x;
|
int max = x;
|
||||||
@ -16,8 +16,6 @@ int maximum()
|
|||||||
if ( z > max ) {
|
if ( z > max ) {
|
||||||
max = z;
|
max = z;
|
||||||
}
|
}
|
||||||
// pokud je y vetsi, ulozime jej do max
|
|
||||||
// pokud je z vetsi, ulozime jej do max
|
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,20 +23,18 @@ int minimum()
|
|||||||
{
|
{
|
||||||
int selection, max, min = 0;
|
int selection, max, min = 0;
|
||||||
|
|
||||||
while ( selection != 8 ) {
|
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
printf("Zadejte 3 cisla oddelena mezerou: ");
|
|
||||||
printf("** printmin **\n");
|
printf("** printmin **\n");
|
||||||
|
printf("Zadejte 3 cisla oddelena mezerou: ");
|
||||||
|
|
||||||
scanf("%d%d%d", &x, &y, &z);
|
scanf("%d%d%d", &x, &y, &z);
|
||||||
int min = x;
|
min = x;
|
||||||
|
|
||||||
if ( y < min ) {
|
if ( y < min ) {
|
||||||
min = y;
|
min = y;
|
||||||
}
|
}
|
||||||
if ( z < min ) {
|
if ( z < min ) {
|
||||||
min = z;
|
min = z;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user