newcows options -T and -p
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
# cowsay
|
# cowsay
|
||||||
|
|
||||||
cowsay project for school
|
cowsay project for school
|
||||||
|
|
||||||
|
# Preliminaries
|
||||||
|
|
||||||
|
cowsay options :
|
||||||
|
|
||||||
|
- -e/--eyes
|
||||||
|
- -T
|
||||||
|
-
|
||||||
|
|
||||||
|
|||||||
3
src/C/newcows/makefilealacon.sh
Executable file
3
src/C/newcows/makefilealacon.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
clang "$1" -o "${1%%.c}".out
|
||||||
22
src/C/newcows/newcowT.c
Normal file
22
src/C/newcows/newcowT.c
Normal 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
23
src/C/newcows/newcowp.c
Normal 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user