newcows options -T and -p

This commit is contained in:
2026-04-26 22:39:02 +02:00
parent eab4fe940e
commit edc421996f
4 changed files with 58 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
# cowsay
cowsay project for school
cowsay project for school
# Preliminaries
cowsay options :
- -e/--eyes
- -T
-

View File

@@ -0,0 +1,3 @@
#!/bin/bash
clang "$1" -o "${1%%.c}".out

22
src/C/newcows/newcowT.c Normal file
View File

@@ -0,0 +1,22 @@
#include <stdio.h>
#include <string.h>
void affiche_vache(char tongue[3]) {
printf(" \\ ^__^\n");
printf(" \\ (oo)\\_______\n");
printf(" (__)\\ )\\/\\\n");
printf(" %s ||----w |\n", tongue);
printf(" || ||\n");
}
int main(int argc, char *argv[]) {
char tongue[3] = "";
if (argc == 3 && (strcmp(argv[1], "-T") == 0)) {
strncpy(tongue, argv[2], 2);
tongue[2] = '\0';
}
affiche_vache(tongue);
return 0;
}

23
src/C/newcows/newcowp.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
void affiche_vache(char message[128]) {
printf(" _____\n");
printf("< %s >\n", message);
printf(" -----\n");
printf(" \\ ^__^\n");
printf(" \\ (@@)\\_______\n");
printf(" (__)\\ )\\/\\\n");
printf(" ||----w |\n");
printf(" || ||\n");
}
int main(int argc, char *argv[]) {
if (argc != 3) {
printf("Usage : -p 'message'\n");
return 1;
}
affiche_vache(argv[2]);
return 0;
}