Mise à jour du git
This commit is contained in:
87
APL1.1/Dev1.1/Fonctions/decoupage.c
Normal file
87
APL1.1/Dev1.1/Fonctions/decoupage.c
Normal file
@@ -0,0 +1,87 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
int choice;
|
||||
int x;
|
||||
int menu()
|
||||
{
|
||||
printf("--------------\n");
|
||||
printf(" 1) Triangle\n");
|
||||
printf(" 2) Carré\n");
|
||||
printf(" 3) Quitter\n");
|
||||
printf("Votre choix ?");
|
||||
scanf("%d", &choice);
|
||||
|
||||
return choice;
|
||||
}
|
||||
int carree()
|
||||
{
|
||||
int c,h,cpt,cpt2;
|
||||
c=0;
|
||||
printf ("Hauteur ?");
|
||||
scanf ("%d", &h);
|
||||
while(c < h)
|
||||
{
|
||||
printf("*");
|
||||
c=c+1;
|
||||
}
|
||||
c=0;
|
||||
printf("\n");
|
||||
h=h-2;
|
||||
while(cpt < h)
|
||||
{
|
||||
printf("*");
|
||||
while(cpt2 < h)
|
||||
{
|
||||
printf(" ");
|
||||
cpt2=cpt2+1;
|
||||
}
|
||||
printf("*\n");
|
||||
cpt=cpt+1;
|
||||
cpt2=0;
|
||||
}
|
||||
h=h+2;
|
||||
while(c < h)
|
||||
{
|
||||
printf("*");
|
||||
c=c+1;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
int triangle()
|
||||
{
|
||||
int h,cpt,c,i;
|
||||
cpt=0;
|
||||
printf ("Hauteur ?");
|
||||
scanf("%d", &h);
|
||||
while(cpt < h)
|
||||
{
|
||||
while(c <= i)
|
||||
{
|
||||
printf("*");
|
||||
c=c+1;
|
||||
}
|
||||
i=i+1;
|
||||
printf("\n");
|
||||
cpt=cpt+1;
|
||||
c=0;
|
||||
}
|
||||
}
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
choice=menu(choice);
|
||||
|
||||
if(choice == 1)
|
||||
{
|
||||
choice=triangle();
|
||||
}
|
||||
if(choice == 2)
|
||||
{
|
||||
choice=carree();
|
||||
}
|
||||
if(choice == 3)
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
printf("%d", choice);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
57
APL1.1/Dev1.1/Fonctions/miroir.c
Normal file
57
APL1.1/Dev1.1/Fonctions/miroir.c
Normal file
@@ -0,0 +1,57 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<time.h>
|
||||
#define MIN -50
|
||||
#define MAX 50
|
||||
int affiche(int tab[])
|
||||
{
|
||||
int cpt=0;
|
||||
int cpt2 = 0;
|
||||
int cpt3 = 0;
|
||||
int tab2[10];
|
||||
printf("+-----+-----+-----+-----+-----+-----+-----+-----+-----+----+\n");
|
||||
printf("|");
|
||||
cpt3=9;
|
||||
while(cpt3>=0)
|
||||
{
|
||||
printf("%3d | ", tab2[cpt3]);
|
||||
cpt3--;
|
||||
}
|
||||
printf("\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+----+\n");
|
||||
printf("|");
|
||||
cpt3=0;
|
||||
return tab2[10];
|
||||
}
|
||||
int aleatoire(int taille){
|
||||
int tab[10];
|
||||
int cpt = 0;
|
||||
int cpt2 = 0;
|
||||
int cpt3 = 0;
|
||||
srand(time(NULL));
|
||||
while(cpt<10)
|
||||
{
|
||||
tab[cpt]=rand()%(MAX+(-MIN))+MIN;
|
||||
cpt++;
|
||||
}
|
||||
return taille;
|
||||
}
|
||||
int inverse() {
|
||||
int tab2[10];
|
||||
int cpt2=0;
|
||||
while(cpt2<=9)
|
||||
{
|
||||
printf("%3d | ", tab2[cpt2]);
|
||||
cpt2++;
|
||||
}
|
||||
printf("\n+-----+-----+-----+-----+-----+-----+-----+-----+-----+----+\n");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
int tab[10];
|
||||
aleatoire(10);
|
||||
affiche(tab);
|
||||
inverse();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
14
APL1.1/Dev1.1/Fonctions/zero.c
Normal file
14
APL1.1/Dev1.1/Fonctions/zero.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
double zero(double a) {
|
||||
a = 0.0;
|
||||
return a;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
double x=37.5;
|
||||
printf("avant : %f\n", x);
|
||||
x=zero(x);
|
||||
printf("après : %f\n", x);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user