added args to the program
you can turn on/off colors, and set the graph size
This commit is contained in:
16
polynome.c
16
polynome.c
@@ -201,7 +201,7 @@ enum STATUS Dessiner_Graph(Poly* poly) {
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
if (argc < 4) {
|
||||
fprintf(stderr, "%s", "[-] usage : poly.exe a b c [--colors]\n");
|
||||
fprintf(stderr, "%s", "[-] usage : poly.exe a b c [--size 20] [--colors]\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -210,8 +210,22 @@ int main(int argc, char* argv[]) {
|
||||
float c = atof(argv[3]);
|
||||
|
||||
if (argc > 4) {
|
||||
if (strcmp(argv[4], "--size") == 0) {
|
||||
if (argc >= 5) {
|
||||
LONGUEUR_X = strtol(argv[5], NULL, 10);
|
||||
LONGUEUR_Y = LONGUEUR_X;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(argv[4], "--colors") == 0) {
|
||||
use_colors = true;
|
||||
}
|
||||
if (argc >= 7) {
|
||||
if (strcmp(argv[6], "--colors") == 0) {
|
||||
use_colors = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("[+] Processing %.3fx^2%.3fx%.3f\n", a, b, c);
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ enum STATUS Calcul_Sommet(Poly* poly);
|
||||
enum STATUS Calcul_Fonction(Poly* poly, float x, float *out);
|
||||
enum STATUS Calcul_Derivee(Poly* poly, float x, float *out);
|
||||
|
||||
#define LONGUEUR_X 20
|
||||
#define LONGUEUR_Y 20
|
||||
int LONGUEUR_X = 20;
|
||||
int LONGUEUR_Y = 20;
|
||||
void Dessiner_Separateur();
|
||||
bool use_colors = false;
|
||||
int use_colors = false;
|
||||
enum STATUS Dessiner_Graph(Poly* poly);
|
||||
int main();
|
||||
Reference in New Issue
Block a user