added project files and .drone.yml
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
f7a435b5fe
commit
4ea499623e
87
.drone.yml
Normal file
87
.drone.yml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: testing-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
pull: always
|
||||||
|
image: immawanderer/archlinux-cdev
|
||||||
|
commands:
|
||||||
|
- cmake CMakeLists.txt
|
||||||
|
- make
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: notifications
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
- "release/*"
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- testing-amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: discord
|
||||||
|
pull: always
|
||||||
|
image: appleboy/drone-discord:1.2.4
|
||||||
|
settings:
|
||||||
|
message: "{{#success build.status}} ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{else}} ❌ Build #{{build.number}} of `{{repo.name}}` failed.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{/success}}\n"
|
||||||
|
webhook_id:
|
||||||
|
from_secret: discord_webhook_id
|
||||||
|
webhook_token:
|
||||||
|
from_secret: discord_webhook_token
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
name: notifications-cronbuild
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- cron
|
||||||
|
cron:
|
||||||
|
- hourly
|
||||||
|
- hourly-build
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- testing-amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: discord
|
||||||
|
pull: always
|
||||||
|
image: appleboy/drone-discord:1.2.4
|
||||||
|
settings:
|
||||||
|
message: "{{#success build.status}} ✅ Build #{{build.number}} of `{{repo.name}}` succeeded.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{else}} ❌ Build #{{build.number}} of `{{repo.name}}` failed.\n\n📝 Commit by {{commit.author}} on `{{commit.branch}}`:\n``` {{commit.message}} ```\n\n🌐 {{ build.link }} {{/success}}\n"
|
||||||
|
webhook_id:
|
||||||
|
from_secret: discord_webhook_hourly_id
|
||||||
|
webhook_token:
|
||||||
|
from_secret: discord_webhook_hourly_token
|
5
CMakeLists.txt
Normal file
5
CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
project(pjc-0x03 LANGUAGES C)
|
||||||
|
|
||||||
|
add_executable(pjc-0x03 main.c minmax.c minmax.h main.h)
|
@ -1,5 +1,5 @@
|
|||||||
# pjc-0x03
|
# pjc-0x03
|
||||||
|
|
||||||
[![works badge](https://cdn.jsdelivr.net/gh/nikku/works-on-my-machine@v0.2.0/badge.svg)](https://github.com/nikku/works-on-my-machine)
|
[![Build Status](https://drone.dotya.ml/api/badges/wanderer/PJC-0x03/status.svg?ref=refs/heads/master)](https://drone.dotya.ml/wanderer/PJC-0x03) [![works badge](https://cdn.jsdelivr.net/gh/nikku/works-on-my-machine@v0.2.0/badge.svg)](https://github.com/nikku/works-on-my-machine)
|
||||||
|
|
||||||
sawce of project 0x03 for c programming classes
|
sawce of project 0x03 for c programming classes
|
||||||
|
65
main.c
Normal file
65
main.c
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "main.h"
|
||||||
|
#include "minmax.h"
|
||||||
|
|
||||||
|
int get_userguess(){
|
||||||
|
int x = -1;
|
||||||
|
int ok = -1;
|
||||||
|
while( ok != 1){
|
||||||
|
ok = scanf("%d", &x);
|
||||||
|
if(ok == EOF){
|
||||||
|
printf("\ncaught Ctrl+D...\n");
|
||||||
|
ok = 1;
|
||||||
|
x = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(ok == 0){
|
||||||
|
while (fgetc(stdin) != '\n'){
|
||||||
|
}
|
||||||
|
printf("[*] give me a correct value\n");
|
||||||
|
printf("[*] stop gibbering around\n my guess >>> ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lemmego(){
|
||||||
|
printf("[*] you wished to go, quitting...\n");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int selection, max, min = 0;
|
||||||
|
|
||||||
|
while ( selection != 8 ) {
|
||||||
|
printf("\npick a choice\n");
|
||||||
|
printf("1 - max\n"
|
||||||
|
"2 - min\n"
|
||||||
|
"3 - multiplication\n"
|
||||||
|
"4 - division\n"
|
||||||
|
"8 - quit\n"
|
||||||
|
">> ");
|
||||||
|
|
||||||
|
selection = get_userguess();
|
||||||
|
|
||||||
|
switch ( selection ) {
|
||||||
|
case 1:
|
||||||
|
max = maximum();
|
||||||
|
printf("maximum je %d\n", max);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
min = minimum();
|
||||||
|
printf("minumum je %d\n", min);
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
lemmego();
|
||||||
|
return 9000;
|
||||||
|
default:
|
||||||
|
printf("invalid option\n");
|
||||||
|
selection = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
8
main.h
Normal file
8
main.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef PJC_0X03_MAIN_H
|
||||||
|
#define PJC_0X03_MAIN_H
|
||||||
|
|
||||||
|
int get_userguess();
|
||||||
|
|
||||||
|
int lemmego();
|
||||||
|
|
||||||
|
#endif //PJC_0X03_MAIN_H
|
44
minmax.c
Normal file
44
minmax.c
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "minmax.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
int maximum()
|
||||||
|
{
|
||||||
|
int x, y, z;
|
||||||
|
printf("Zadejte 3 cisla oddelena mezerou: ");
|
||||||
|
printf("** printmax **\n");
|
||||||
|
|
||||||
|
scanf("%d%d%d", &x, &y, &z);
|
||||||
|
int max = x;
|
||||||
|
if ( y > max ) {
|
||||||
|
max = y;
|
||||||
|
}
|
||||||
|
if ( z > max ) {
|
||||||
|
max = z;
|
||||||
|
}
|
||||||
|
// pokud je y vetsi, ulozime jej do max
|
||||||
|
// pokud je z vetsi, ulozime jej do max
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
int minimum()
|
||||||
|
{
|
||||||
|
int selection, max, min = 0;
|
||||||
|
|
||||||
|
while ( selection != 8 ) {
|
||||||
|
int x, y, z;
|
||||||
|
printf("Zadejte 3 cisla oddelena mezerou: ");
|
||||||
|
printf("** printmin **\n");
|
||||||
|
|
||||||
|
scanf("%d%d%d", &x, &y, &z);
|
||||||
|
int min = x;
|
||||||
|
|
||||||
|
if ( y < min ) {
|
||||||
|
min = y;
|
||||||
|
}
|
||||||
|
if ( z < min ) {
|
||||||
|
min = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}
|
10
minmax.h
Normal file
10
minmax.h
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#ifndef PJC_0X03_MINMAX_H
|
||||||
|
#define PJC_0X03_MINMAX_H
|
||||||
|
|
||||||
|
//int maximum(int x, int y, int z);
|
||||||
|
int maximum();
|
||||||
|
|
||||||
|
//int minimum(int x, int y, int z);
|
||||||
|
int minimum();
|
||||||
|
|
||||||
|
#endif //PJC_0X03_MINMAX_H
|
Loading…
Reference in New Issue
Block a user